The problem is: Interestingly, the value of e can also be approximated using the following expression: 2+1/(1+1/(2+2/(3+3/(4+4/(5+5/(n+n))))))
Fantastic news! We've Found the answer you've been seeking!
Question:
The problem is: "Interestingly, the value of e can also be approximated using the following expression:
2+1/(1+1/(2+2/(3+3/(4+4/(5+5/(n+n))))))
Write a program that uses this formula to approximate the value of e.
The program should prompt the user to input a value for n and then output the approximate value of e. Use setprecision(15) to format the output for the tests.
Test your program for n = 3, 5, 10, 50, and 100."
I can get the answer for when n=3 that is rounded (aka e=3 not 2.700000000000), but I do not know how to loop these values or proceed forth in increments.
Related Book For
Posted Date: