#include<stdio.h>
int main()
{
int i=0;
int n=0;
int ret=1; //阶乘
int sum=0; //和
for(n=1;n<=10;n++) //限定n的范围
{
ret=1; //阶乘从1开始
for(i=1;i<=n;i++)//n的范围
{
ret=ret*i;
}
sum=sum+ret;
}
printf("sum=%d\n",sum);
return 0;
}
标签:10,int,sum,ret,计算,阶乘,+......+,main From: https://blog.51cto.com/u_16329012/8175382