题解 | #小乐乐求和#
小乐乐求和
https://www.nowcoder.com/practice/ce0b2eacd3d04647831358c2876e44ff
#include <stdio.h> int main() { long n = 0;//输入正整数 long sum = 0;//求和 scanf("%ld", &n); for (int i = 1 ; i <= n; i++) { sum += i; } printf("%ld", sum); return 0; }