1) In main(), the program should prompt the user for an integernumber 2) You wil
ID: 3610163 • Letter: 1
Question
1) In main(), the program should prompt the user for an integernumber2) You will create a function called
double calcPi(int n)
which will calculate PI using the taylor series to nth degree. Theresulting value should be returned.
3) The returned value will then be printed out in the main()function and the difference between your PI and the actual value ofPI should be printed out..
The main chunk of debugging is monitoring the calculation of PIthrough i=0 to n, to make sure that the calculations make sense andthe value looks to be converging to the correct value of PI. Forevery value of i, denote the approximate value of PI in your readmefile, and determine a value of i such that the error between yourPI and the actual value are < .0001.
Explanation / Answer
please rate - thanks formula from http://www.math.hmc.edu/funfacts/ffiles/30001.1-3.shtml #include #include double calcPi(int); int main() {int n; double pi=3.14159,newpi; coutn; newpi=calcPi(n); coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.