# Thread: Need help with e constant approximation program

1. ## Need help with e constant approximation program

I have to write a program using the formula e = (1+1/1! + 1/2!+...+1/n!) to approximate the value of e. THe program should ask the user to type in a maximum value for the error in the approximation, where this error is the difference between the calculated approximate value and the real value of e. Then have the program display the final value of e obtained by each series and the number of iterations required to get the input accuracy for e. The real value of e to be used is 2.71828182845904523536. The program should work for errors as small as 0.00000001. The approximation should display correctly to twelve decimal places. Can anybody help me out i have no idea where to start?

2. Write some code that prompts for user input; get it to compile.
Output the value entered.

Learn how to do loops.

Read the forum policy on homework. http://cboard.cprogramming.com/c-pro...-homework.html

Tim S.

3. I'm starting to figure it out but I don't understand what it means by displaying the number of iterations required to get the input accuracy for e.

4. Originally Posted by tsjohnsoniii
The program should work for errors as small as 0.00000001.
Good luck with that.

Quzah.

5. Originally Posted by tsjohnsoniii
I'm starting to figure it out but I don't understand what it means by displaying the number of iterations required to get the input accuracy for e.
theError = theRealE - yourCalculatedE

Then stop if theError is less than required error.

I am NOT giving anymore till YOU DO REAL WORK and Post Code.

Tim S.

6. Originally Posted by stahta01
theError = theRealE - yourCalculatedE

Then stop if theError is less than required error.