【C】#牛牛学数列4#
牛牛学数列4
https://www.nowcoder.com/practice/586b114f52034688879342ba45779081
#include <stdio.h> int main() { int n, sum = 0, tmp = 0; scanf("%d", &n); for (int i = 1; i <= n; i++) { tmp += i; sum += tmp; } printf("%d", sum); return 0; }
牛牛学数列4
https://www.nowcoder.com/practice/586b114f52034688879342ba45779081
#include <stdio.h> int main() { int n, sum = 0, tmp = 0; scanf("%d", &n); for (int i = 1; i <= n; i++) { tmp += i; sum += tmp; } printf("%d", sum); return 0; }
相关推荐