c语言s = 1+(1+2)+(1+2+3)+...+(1+2+3+...+N)值,先写一个1+2+的计算...+.

# include & ltstdio.h & gt

整数求和

{

int sum = 0;

for(int I = 1;我& lt= n;i++)

sum = sum+I;

返回总和;

}

int main()

{

int sum,n;

sum = 0;

Printf("请输入n:\ n ");

scanf("%d ",& ampn);

for(int I = 1;我& lt= n;i++)

sum = sum+sumn(I);

printf("%d ",sum);

}