计算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/07/05 13:44:33
![计算e的近似值,求在数学上为什么这么算? 在线等#include main( ) { double e =1.0, x=1.0, y, detax; int i=1; printf (](/uploads/image/z/1808561-65-1.jpg?t=%E8%AE%A1%E7%AE%97e%E7%9A%84%E8%BF%91%E4%BC%BC%E5%80%BC%2C%E6%B1%82%E5%9C%A8%E6%95%B0%E5%AD%A6%E4%B8%8A%E4%B8%BA%E4%BB%80%E4%B9%88%E8%BF%99%E4%B9%88%E7%AE%97%3F+%E5%9C%A8%E7%BA%BF%E7%AD%89%23include++main%28+%29+%7B+double++e+%3D1.0%2C+x%3D1.0%2C+y%2C+detax%3B+int+i%3D1%3B+printf+%28%22%5Cn+please+enter+a+error%3A%22%29%3B+scanf+%28%22%25lf%22%2C%26detax%29%3B+y+%3D1%2Fx%3B+while+%28y%3E%3Ddetax%29++%7B+++++x%3Dx+%2Ai%3B++++++++y%3D1%2Fx%3B++++++++e%3De%2B)
计算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我在做任务,虽然你已经知道了,还是采纳我吧,