一道C语言题,计算1 + 1/1!+1/2!+1/3!+...+1/n!.帮忙改下程序#include #include int main(void){int i = 1; double p = 1,fac = 0;do{ p = p * i;fac = fac + 1 / p;i++;} while ((1 / fac) > 0.00001);printf("e = %lf",fac + 1);return 0;}

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/24 04:37:46
一道C语言题,计算1 + 1/1!+1/2!+1/3!+...+1/n!.帮忙改下程序#include #include int main(void){int i = 1; double p = 1,fac = 0;do{ p = p * i;fac = fac + 1 / p;i++;} while ((1 / fac) > 0.00001);printf(
x){ed׾Xr >_7PA[PPQPD+jyzOw{);~~̼ҔT8#3D!713O,?3ETU0VH/MIU(tuJ~5X@AK!" "PW(ֶU(e5 PӺhGR*PjNTuQjIiQВZ"}xlܳXx U%!c  DD"t\  '0`ALb`ixA̳/eDrm^/{Ȋ<;Pŕb2

一道C语言题,计算1 + 1/1!+1/2!+1/3!+...+1/n!.帮忙改下程序#include #include int main(void){int i = 1; double p = 1,fac = 0;do{ p = p * i;fac = fac + 1 / p;i++;} while ((1 / fac) > 0.00001);printf("e = %lf",fac + 1);return 0;}
一道C语言题,计算1 + 1/1!+1/2!+1/3!+...+1/n!.帮忙改下程序
#include
#include
int main(void)
{
int i = 1;
double p = 1,fac = 0;
do
{
p = p * i;
fac = fac + 1 / p;
i++;
} while ((1 / fac) > 0.00001);
printf("e = %lf",fac + 1);
return 0;
}

一道C语言题,计算1 + 1/1!+1/2!+1/3!+...+1/n!.帮忙改下程序#include #include int main(void){int i = 1; double p = 1,fac = 0;do{ p = p * i;fac = fac + 1 / p;i++;} while ((1 / fac) > 0.00001);printf("e = %lf",fac + 1);return 0;}
#include
#include
int main(void)
{
int i = 1;
double p = 1,fac = 0;
do
{
p = p * i;
fac = fac + 1 / p;
i++;
} while ((1 / p) > 0.00001); //注意这里
printf("e = %lf",fac + 1);
return 0;
}