# Sum Problem

## Problem Description

Hey, welcome to HDOJ(Hangzhou Dianzi University Online Judge).
In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + … + n.

## Input

The input will consist of a series of integers n, one integer per line.
（输入将由一系列整数n组成，每行一个整数）

## 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.
（对于每种情况，在一行中输出SUM（n），后跟一个空行。您可以假设结果在32位有符号整数的范围内）

1
100

1

5050

## Source Code

#include<stdio.h>
int main()
{
int i,n,sum;
while(scanf("%d",&n)!=EOF)
{
sum=0;
for(i=1;i<=n;i++)
{
sum+=i;
}
printf("%d\n\n",sum);
}
return 0;
}

©️2019 CSDN 皮肤主题: 游动-白 设计师: 上身试试