杭州电子科技大学ACM-1001


Input
The input will consist of a series of integers n, one integer per line.
 输入包括一系列的整数,每行一个整数。

Output
For each case, output SUM(n) in one line, followed by a blank line. You may assume the result will be in the range of 32-bit signed integer.
对于每一种情况下,输出和(N)在一条线上,用一个空行。你可能会得到的结果将在32位有符号整数。



#include

using namespace std;
int main()
{
	int k;
	int i;
	int sum = 0;
	while (cin >> k )
	{

		for (i = 1; i <= k; ++i)
		{
			sum += i;
			
		}
		cout << sum << endl<


你可能感兴趣的:(ACM)