<h1 style="color: rgb(26, 92, 200);">Sum Problem</h1><strong><span style="color: green; font-family: Arial; font-size: 12px; font-weight: bold;">Time Limit: 1000/500 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 278981 Accepted Submission(s): 69733
</span></strong>
<div align="left" class="panel_title">Problem Description</div><div class="panel_content">Hey, welcome to HDOJ(Hangzhou Dianzi University Online Judge).
In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n.
</div><div class="panel_bottom"> </div>
<div align="left" class="panel_title">Input</div><div class="panel_content">The input will consist of a series of integers n, one integer per line.
</div><div class="panel_bottom"> </div>
<div align="left" class="panel_title">Output</div><div class="panel_content">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.
</div><div class="panel_bottom"> </div>
<div align="left" class="panel_title">Sample Input</div><div class="panel_content"><pre><div style="font-family: Courier New,Courier,monospace;">1
100</div>
Sample Output
1 5050
#include<iostream>
using namespace std;
int main()
{
int n;
while(cin>>n)
{
long sum;
sum = 0;
for(int i = 1;i <=n;i ++)
sum += i;
cout << sum<<endl<<endl;
}
}