bn9

bn9

  • NA
  • 24
  • 0

the value of e

Feb 29 2004 9:03 PM
i am trying to write a program that output the value of e (exponential) using an infintie series. with e^(x) and you set x equal to 1 you can find the value of e. the program uses 20 terms. i have everthing in the program ok, but i cant figure out how to set the equation in the program. can someone PLEASE help?? thank you int n ; // set double integers. e which is constant // y, for the value of the equation, and x // for the difference from e and y double e, y, x; // Display column titles Console.WriteLine("Terms e error"); // begin number of terms at one n=1; //set e to constant value e=2.718281828459045; // forever loop while n is between 1 and 20 for(n=1; n<=20; n++) { ------------------>>>>>>>>>>>>THIS IS THE POINT OF CONFUSION!!?!! y = ?????????? // y equals e^(x) in infinite series equation // set difference in equation from actual value of e // known as 'error' in the program x = e-y; // Display values in the 3 columns Console.WriteLine("{0} {1} {2}", n, y, x); // increment n

Answers (2)