Sum Till N - I
You are given an integer N for each test case. Calculate the sum of all integers from 1 to N.
Input
- The input contains one integer N
Output
Print the sum of all integers from 1 to N, without labels or trailing spaces.
Example 1:
Input:
10
Output:
55
Explanation:
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55.
The sum of the integers from 1 through 10 is 55.
Example 2:
Input:
100
Output:
5050
Explanation:
The sum of the integers from 1 through 100 is 5050.
Now Your Turn!
Pick the correct output for the given inputInput:
7
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 1 <= N <= 10000