#include<iostream> using namespace std; int main() { int n = 0, sum; while (cin>>n) { sum = 0; // 这里要清零 for (int i =0; i <= n; i++) { sum += i; } cout << sum <<endl <<endl; } return 0; }
杭电oj 1001,布布扣,bubuko.com
杭电oj 1001
原文:http://www.cnblogs.com/lingc/p/3717919.html