求1到10阶乘的和
本人学生菜鸡一个,是在想不清楚问题出在哪,望各位高手多多教导!
别的方法我懂,但是如果非要按变量递减的循环这个思路,怎么操作?
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
int main()
{
int a = 0;
int b = 0;
int c = 1;
int d = 0;
for (a=10;a>1;a--)
{
for (b=a,c=1; b> 1; b--)
{
c = c * a;
}
d += c;
}
printf("%d\n", d);
return 0;
}