Question
You can use the Gregory-Leibniz series to compute an approximate value of : 4(11 3+1 51 7+1 9 1 11++(1)+1 (21)) Write a C++ program
You can use the Gregory-Leibniz series to compute an approximate value of : 4(11 3+1 51 7+1 9 1 11++(1)+1 (21)) Write a C++ program that uses this series to compute and print an approximation of , where n is the number of terms in the series. Prompt the user to enter the number of terms. Format the output to display five decimal places. It must contain a do-while statement. Your program must include a for-statement. The Gregory-Leibniz series converges so slowly (requiring many terms to give a close approximation) that it is of little practical value. As of March 21, 2022, the world record calculation used the Chudnovsky formula to compute to 100 trillion decimal places. Sample Run Here are some samples of how the screen must look when your program runs. You must strictly follow this format, wording, spacing, and alignment, including the number of decimal places on the numbers. The characters in red are typed by the user. The other characters are output by the program. Sample #1 How many terms? 10 Approximation of pi: 3.04184 Sample #2 How many terms? 100 Approximation of pi: 3.13159
Sample #3 How many terms? 5000 Approximation of pi: 3.14139 Sample #4 How many terms? 200000 Approximation of pi: 3.14159
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started