作业帮 > 综合 > 作业

vc++计算e的近似值这样做有什么错?

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/22 08:51:21
vc++计算e的近似值这样做有什么错?
#include
void main()
{ double e=1.0,x=1.0,y,detax;
int i=1;
printf("\n please enter a detax:");
scanf("%lf",&detax);
y=1/x;
while(y>-detax)
{
\x05 x=x*i;
\x05 y=1/x;
\x05 e=e=y;
\x05 ++i;
}
printf("%12.101f",e);
}
void main()
{ double e=1.0,x=1.0,y,detax;
int i=1;
printf("\n please enter a detax:");
scanf("%lf",&detax);
y=1/x;
while(y>=detax)
{
\x05x=x*i;
\x05y=1/x;
\x05e+=y;
\x05++i;
}
printf("%12.101f",e);
}