- 5

Can any one write for me the code to find the sum of consecutive numbers

N = int(input()) i = (range(N)) i+=1 while i in range(N): print (int(i))

15th Jun 2021, 10:34 AM
Yiga Mark Dan
Yiga Mark Dan - avatar
3 Antworten
+ 3
N = int(input()) a = [i for i in range(0, N + 1)] print(sum(a))
15th Jun 2021, 10:43 AM
SammE
SammE - avatar
15th Jun 2021, 10:45 AM
HNL
HNL - avatar