题解 | #小乐乐求和#
小乐乐求和
http://www.nowcoder.com/practice/ce0b2eacd3d04647831358c2876e44ff
#include<stdio.h>
int main() {
long n = 0, sum = 0;
scanf("%d", &n);
while (n) sum += n--;
printf("%ld", sum);
return 0;
}
int main() {
long n = 0, sum = 0;
scanf("%d", &n);
while (n) sum += n--;
printf("%ld", sum);
return 0;
}