#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[])
{
int layer=0;//每层的数量
int sum=0;//累加到当前层的总数
for(int i=1;i<=100;i++)
{
layer+=i;//每层的数量都等于上一层的数量加此层的序号
sum+=layer;
}
cout<<sum;
return 0;
//system("pause");
}
03-31
155
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountBlack.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交