#include
int main()
{
int n;
int i;
int sum = 0;
int value = 1;
printf("please input n :\n");
scanf("%d",&n);
for(i = 1; i <= n; i++)
value = value*i;
sum = sum + value;
}
printf("the result is :%d\n", sum);
return 0;
运行结果如下: