利用泰勒级数求e的值,要求最后一项的值大于10的-5次方,不知哪里错了,求指点
#include<stdio.h>#include<math.h>
main()
{
double e,j,i;
do
{
j=1.0,i=1,e=0;
j=i*j;
e=e+(1.0/j);
i++;
}
while((1.0/j)>pow(10,-5));
printf("e=%f\n",e);
}
2011-11-17 18:06
。
2011-11-17 18:08
程序代码:#include<stdio.h>
#include<math.h>
main()
{
double e,j,i;
j=1.0,i=1,e=1;
do
{
j=i*j;
e=e+(1.0/j);
i++;
}
while((1.0/j)>pow(10,-5));
printf("e=%f\n",e);
}
2011-11-17 20:26
2011-11-17 20:35
2011-11-17 21:15