7 Answers
+ 12
As Cheeze-Senpai would come over and say:
www.codewars.com
+ 6
Yeah, www.codewars.com
Jesus I really sound like an ambassador for this site.
+ 4
Thanks)
+ 2
Help plis ?
+ 1
Help the python ??
No one likes homework, but your math teacher has given you an assignment to find the sum of the first N numbers.
Letâs save some time by creating a program to do the calculation for you!
Take a number N as input and output the sum of all numbers from 1 to N (including N).
Sample Input
100
Sample Output
5050
Explanation: The sum of all numbers from 1 to 100 is equal to 5050
0
N = int(input())
for i in range(0,N+1):
sum = N*(N+1)/2
print(int(sum))
break
0
Sum of Consecutive Numbers
No one likes homework, but your math teacher has given you an assignment to find the sum of the first N numbers.
Letâs save some time by creating a program to do the calculation for you!
Take a number N as input and output the sum of all numbers from 1 to N (including N).
Sample Input
100
Sample Output
5050