A - Triangular Number
Editorial
/
/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 100 点
問題文
正整数 N が与えられます。
1 以上 N 以下の整数をすべて足し合わせた値 1+2+\cdots+N を出力してください。
制約
- 1 \leq N \leq 100
- N は整数
入力
入力は以下の形式で標準入力から与えられる。
N
出力
1 以上 N 以下の整数をすべて足し合わせた値を出力せよ。
入力例 1
5
出力例 1
15
1+2+3+4+5=15 のため、15 を出力します。
入力例 2
1
出力例 2
1
入力例 3
29
出力例 3
435
Score : 100 points
Problem Statement
You are given a positive integer N.
Output the sum of all integers from 1 to N, that is, 1+2+\cdots+N.
Constraints
- 1 \leq N \leq 100
- N is an integer.
Input
The input is given from Standard Input in the following format:
N
Output
Output the sum of all integers from 1 to N.
Sample Input 1
5
Sample Output 1
15
Since 1+2+3+4+5=15, output 15.
Sample Input 2
1
Sample Output 2
1
Sample Input 3
29
Sample Output 3
435