#include <stdio.h>
int main()
{
int n;
int i;
int multiValue = 1;
scanf("%d", &n);
if(n <=0)
{
printf("please enter the valid number!\n");
exit(1);
}
int ret = 0;
for(i = 1;i <= n;i++)
{
multiValue *= i;//1*2*3*..n
ret += multiValue;
}
printf("1+(1*2)+(1*2*3)+... = %d\n", ret);
}
追问程序有错误
本回答被网友采纳