Question: An approximate value of pi can be found using this formula: * = 4 [1-3 + - +1 + (Note, n starts as 0

An approximate value of pi can be found using this formula: * = 4 [1-3 + - +1 + (Note, n starts as 0 for the 

An approximate value of pi can be found using this formula: * = 4 [1-3 + - +1 + (Note, n starts as 0 for the first term: (-1)"] 2n+1 =) 2(0)+1 Write a program that approximates pi to a certain number of decimal places. Ask the user to enter n. the number of decimal places of accuracy desired for approximating pi. The tolerance for the while loop should be pow (0.1, n+1). Output: Number of decimal places requested: # Approximation of pi: 3.14... (Output the correct number of decimal places) Number of terms used: # Sample (for 4 decimal places): Number of places requested: 4 Pi 3.1416 Number of terms used: 50000

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!