
January 29th, 2010, 12:03 PM
#1
Computing Pi from the infinite series
Hey guys,
I am brand spanking new to C# and am not only wondering about the syntax, but also the logic of how to do this, my professor just threw us to the wolves with this problem and we haven't gone over any of the syntax or anything, I am not a math major so I'm not familiar with the infinite series, nothing explained! And yet it's due on Monday.
The problem is that she wants a C# console program which computes Pi from an infinite series
Pi = 4  4/3 + 4/5  4/7 + 4/9  4/11 + ....
She said
"Ask the user the number of decimal places you should compute Pi to and display the number of terms (counting the initial 4) that it takes to compute Pi to that many places. The formula can be used to determine if your approximation is close enough
Math.Abs(Math.PI  approxPi) < (0.5 * Math.Pow(0.1, decimalPlaces))
Sample Output:
Please enter the number of decimal places to compute to: 2
It requires 200 terms to approximate Pi to 2 decimal places. "
Please help I am completely lost, I need help with logic and help how to program this in C#.
Posting Permissions
 You may not post new threads
 You may not post replies
 You may not post attachments
 You may not edit your posts

Forum Rules

Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!
