]#include<stdio.h>
int main(){
int t,s;
int n;
t=1;
s=0;
for(n=1;n<=20;n++){
t = t*n;
s = s+t;
}
printf(“%22.15e\n”,s); //出错?
return 0;
}
int main(){
int t,s;
int n;
t=1;
s=0;
for(n=1;n<=20;n++){
t = t*n;
s = s+t;
}
printf(“%22.15e\n”,s); //出错?
return 0;
}
解决方案
10
当然了,指数输出的是实数(float或double)
10
printf(“%22.15e\n”,(double)s);
5
printf("%22.15e\n", s*1.0);
转换一下即可。