1. Engineering
  2. Computer Science
  3. write a program in c that sums a simple series...

Question: write a program in c that sums a simple series...

Question details

Write a program in C++ that sums a simple series. Here are the criteria.

  1. The program requests a number greater than If zero is entered, the program stops. If a number equal to 1 or less than 0 is entered, the program should give an error and return to request another number. The same is true for entering anything other than a number. Your program should not crash or do strange things if you enter the letter A when it asks for a number.
  2. If the number entered is N, sum the series 1/N + 2/N-1 + 3/N-2+ … +N/1. Display the original number and the sum.
  3. Return to request another number.

The objective of this program is for you to demonstrate your knowledge of loops, conditionals, and computation in C++. Try to write this with the fewest number of variables and lines of code as possible. Test the program with small numbers where you can compute the result by hand.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution