C语言的问题,不知道怎么书写 题目编写一个程序,求s=1+(1+2)+(1+2+3)+...+(1+2+3+...+n)。

如题所述

#include<stdio.h>
int main()
{int i,n,t=0,s=0;
 scanf("%d",&n);
 for(i=1;i<=n;i++)
 { t+=i;
   s+=t;
 }
 printf("%d\n",s);
 return 0;
}

温馨提示:答案为网友推荐,仅供参考