计算e的近似值,求在数学上为什么这么算? 在线等#include main( ) { double e =1.0, x=1.0, y, detax; int i=1; printf ("\n please enter a error:"); scanf ("%lf",&detax); y =1/x; while (y>=detax) { x=x *i; y=1/x; e=e+

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/10 23:49:32
计算e的近似值,求在数学上为什么这么算? 在线等#include  main( ) { double  e =1.0, x=1.0, y, detax; int i=1; printf (=detax) { x=x *i; y=1/x; e=e+" />

计算e的近似值,求在数学上为什么这么算? 在线等#include main( ) { double e =1.0, x=1.0, y, detax; int i=1; printf ("\n please enter a error:"); scanf ("%lf",&detax); y =1/x; while (y>=detax) { x=x *i; y=1/x; e=e+
计算e的近似值,求在数学上为什么这么算? 在线等
#include
main( )
{ double e =1.0, x=1.0, y, detax;
int i=1;
printf ("\n please enter a error:");
scanf ("%lf",&detax);
y =1/x;
while (y>=detax)
{ x=x *i;
y=1/x;
e=e+y;
++i;
}
printf ("%12.10lf ",e);
return 0;
}
算了, 知道了

计算e的近似值,求在数学上为什么这么算? 在线等#include main( ) { double e =1.0, x=1.0, y, detax; int i=1; printf ("\n please enter a error:"); scanf ("%lf",&detax); y =1/x; while (y>=detax) { x=x *i; y=1/x; e=e+
while循环体执行之后就是1+1/2+1/3…………一直加到y小于detax,上述式子求极限就是e,所以detax很小的时候就可以求出e的近似值对吧.
lz我在做任务,虽然你已经知道了,还是采纳我吧,