int main()
{
int i = 0;
int n = 0;
int ret = 1;
int sum = 0;
for(n=1;n<=10;n++)
{
ret = 1;
for(i=1;i<=n;i++)
{
ret = ret*i;
}
sum = sum + ret;
}
printf("sum=%d\n",sum);
return 0;
}
//简便方法 一层循环就可以
int main()
{
int i = 0;
int n = 0;
int ret = 1;
int sum = 0;
for(n=1;n<=10;n++)
{
ret = ret*n;
sum = sum + ret;
}
printf("sum=%d\n",sum);
return 0;
}
*/
标签:10,return,int,sum,....,ret,C语言,printf,main From: https://blog.51cto.com/u_15916254/5956417