标签:val 分析 使用 for ret int process ble main
计算 1!+2!+…+100!
程序核心——两个循环的镶嵌
#include<stdio.h>
int main()
{
int i,j,n;
double sum,result;
sum=0;
for(i=1;i<=100;i++)
{
result=1;
for(j=1;j<=i;j++)
result*=j;
sum=sum+result;
}
printf("1!+2!+…+100!=%e\n",sum);
return 0;
}
1!+2!+…+100!=9.426900e+157
--------------------------------
Process exited after 0.2632 seconds with return value 0
请按任意键继续. . .
重点:与4-6相比未使用自定义函数
标签:val 分析 使用 for ret int process ble main
原文地址:https://www.cnblogs.com/5236288kai/p/10660803.html