CodePudding user response:
Reference:# include
Double fun_e ()
{
Double sum=1;//first set to 1
Double temp=1;
int i=1;
While (temp> E=1-4) {//the last item value is less than 10 (4)
Temp=temp/I;//the second 1/1, namely 1/1! ; 1/2, the third is 1/2. ; Item 4 (1/2)/3, namely a third! .
Sum=sum + temp;//[sum=1 + 1/1 + 1/2! + 1/3! + 1/4!! + 1/5 +... + 1/n!]
i++;
}
return sum;//return the sum
}
Int main ()
{
Double e=fun_e ();
Printf (" e=% lf \ n ", e);
return 0;
}