#include <stdio.h> int main() { int n = 0; scanf("%d", &n); int sum = 0; //外层循环变量 for (int i = 1; i <= n; i++) { int t = 0; //内层循环变量-->计算1+2+...+n for (int j = 1; j <= i; j++) { t = t + j; } sum = sum + t; } printf("%d", sum); return 0; }