用do-while来编个小程序来计算1+1⼀2!+1⼀3!+1⼀4!+......的前20项和

2025-04-04 21:43:57
推荐回答(1个)
回答1:

#include
#include
int main()
{
double a=1.0,b,c=0.0;
while(a<=20){
b=1/a;
c=c+b;
a++;
}
printf("%f",c);
}
手写,注意修改