Sum Till N - II
Given a positive integer N, calculate the sum of all integers from 1 to N.
Return the calculated sum.
Example 1:
Input:
N = 5
Output:
15
Explanation:
Sum from 1 to 5 (1 + 2 + 3 + 4 + 5) = 15.
Example 2:
Input:
N = 100
Output:
5050
Explanation:
Sum from 1 to 1000 is 5050.
Now Your Turn!
Pick the correct output for the given inputInput:
N = 15
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 <= 1000