Home > Back-end >  Approximation for PI,
Approximation for PI,

Time:10-05

Title:

Subject to code program, according to the type of PI approximation, until the last item is less than the given precision eps,

PI 2=1 + 1! 3 + 2! 3 x 5 +? + I! 3 x 5 x? (I + 1) 2. PI 2=1 + 1! 3 + 2! 3 x 5 +? + I! 3 x 5 x? (I + 1) 2.


Input format:
Precision eps given in the input in one line, you can use the following statement to read input:
The scanf (" % le ", & amp; Eps);
The output format:
In a row, according to the following format output PI approximation (5) after the decimal point:
PI=approximation
Input the sample:
1-5 e
The output sample:
PI=3.14158




I saw @ cloud mingyue his code in this way, I want to ask why the for loop only temp> eps can ask? Is there a big help me answer!!

CodePudding user response:

What do you want to have conditions? !

What is the temp?
It is a long list of addition formula, add at present, as long as the item is smaller than eps can end