how do I compute the sum?

Apr 29, 2016 at 11:02pm
1. Prompt the user Enter a positive number or 0 to quit:
2. Extract the number into int n
3. If the users enters 0, the program should finish.
4. Otherwise compute the sum
s = 3 + 4/( 2·3·4) − 4 / (4·5·6) + 4 / (6·7·8) − 4 (8·9·10)+ ...± 4 (2n·(2n + 1)·(2n + 2))

5. Print the value of the sum on one line.
6. Print the value of PI on the line below.
Apr 30, 2016 at 4:17am
What have you coded?
Apr 30, 2016 at 7:45pm
have you coded anything so far? try using a for loop to calculate s.
Apr 30, 2016 at 8:01pm
Do you speak spanish?
If is true i can help you better :v

if not:
wut? the sum that you have i don't understand, in the center have "... ±" what is the mean of this?

Apr 30, 2016 at 9:54pm
I havent tried anything, I dont understand very well, I need like a very good explanation with a similar example, and yes I do speak spanish.
Apr 30, 2016 at 10:23pm
#include "std_lib_facilities.h"
int main ()
{
int n;
while (true)
{
cout << "Enter a positive number or '0' to quit.\n";
cin >> n;
if (n == 0)
{
cout << "The program has finished.\n";
break;
}
else
{

}


I dont know what to do inside "else".
Topic archived. No new replies allowed.