Question: Write code in C++ Calculate the value of pi from the infinite series pi = 4 - 4/3 + 4/5 = 4/7 + 4/9 -
Write code in C++

Calculate the value of pi from the infinite series pi = 4 - 4/3 + 4/5 = 4/7 + 4/9 - 4/11 + ... Print a table that shows the approximate value of pi after each of the first 1,000 terms of the series .Use for loop. Use float type for pi and any variables having decimals, and integer for non-decimal variables. Use cstdlib header function library and apply the following code before console output of pi;//Code to set the precision to 8 decimal places* cout.setf(ios::fixed); cout.setf(ios::showpoint); cout.precision(8)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
