0
I need to write a program to Take a number N as input and output the sum of all numbers from 1 to N (including N).
4 Answers
+ 1
n = int(input())
sum = 0
for i in range(n+1):
sum += i
print(sum)
+ 3
print(sum(range(int(input())+1)))
+ 1
You can also do it like this by using a formula!!
N=int(input())
print(int(N*(N+1)/2))
0
The input is358
And the expected output must be 64261