Recommended Answers
Jump to PostThat is the equation. Extract out the terms of the equation. I'll give you the first one:
4Add the next 5 terms to the list, one per line
Jump to PostWhat things change from one term to the next?
Why do you keep writing that equation? I'm asking for a list of the terms, not the equation.
Here are the first two terms:
+4/1
-4/3
Jump to PostYour code does not sum the terms, it only computes a new one every loop.
How do you change the sign from term to term. This is the tricky bit:
Use a separate variable with the value of 1What is this for:
while (ans<=10000);
Jump to PostYour loop makes no sense.
The equation you posted originally was to sum up 10000's of terms to get the value of pi.Take it one step at a time.
What is the assignment statement to add a value to variable? That is what you need to do to …
Jump to PostI don't know why you are trying to use two loops. One will do it.
Try having the code in your loop add a single term to the sum each time.
The terms to be added are as I've posted many times:
+4/1
-4/3
+4/5
-4/7
...If …
All 40 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.