Question: Pi Approximation Pi is a mathematical quantity that associates the area of a circle to its radius. Write a prograrm that approximates the value of

Pi Approximation Pi is a mathematical quantity that associates the area of a circle to its radius. Write a prograrm that approximates the value of pi by using the Leibniz formula: . Since this formula is an infinite series, you will need to prompt the user for how accurate . Rather than using one big pile of main( ), you need to use functions for this calculation . In addition, you need to include at least one const int or cdnst double they want the calculation to be. and pass parameters and work with return values. declaration. Finally, embed your program in a loop so that the calculation can be repeated as often as the user wishes. Round to five decimal places. You can use Wolfram's implementation (http:/www.wolframalpha.com/widgets/view.jsp?id-545e91a14706478de240764245cd4 bd1) as a reference to check your tool's results. Iterations: 1 Pi is approximated to be 4.00000. Iterations: 2 Pi is approximated to be 2.66667. Iterations: 10 Pi is approximated to be 3.04184 . Write a program which produces this output as the examples above: Iterations: (USER INPUT) Pi is approximated to be (approximation rounded to 5th decimal place). You are provided the flexibility to create your own files. While there will likely be multiple methods, the main method must be named getPi(.. .) as a simple interface to a user
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
