哪儿出错了? n的阶乘倒数和:
#include "stdio.h"
int main()
{
int i,j;
double s,sum;
sum=0.0;
for(i=1;i<=10;i++)
for(j=1;j<=i;j++)
s=s*j;
sum=sum+1.0/s;
printf("%lf\n",sum);
return 0;
}
#include "stdio.h"
int main()
{
int i,j;
double s,sum;
sum=0.0;
for(i=1;i<=10;i++)
for(j=1;j<=i;j++)
s=s*j;
sum=sum+1.0/s;
printf("%lf\n",sum);
return 0;
}
2016-04-12
举报