I tried writing a code to find the sum of first n numbers but its not working. Please help me I'm a noob | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I tried writing a code to find the sum of first n numbers but its not working. Please help me I'm a noob

n=int(input("enter n-")) for i in range(0,n): m+=i print(m)

22nd Jul 2019, 11:39 AM
ERROR_404
ERROR_404 - avatar
3 Answers
+ 1
~ swim ~ thank you so much ma man (can you explain why only 0 tho?)
22nd Jul 2019, 1:16 PM
ERROR_404
ERROR_404 - avatar
+ 1
~ swim ~ kay man tqsm
22nd Jul 2019, 1:25 PM
ERROR_404
ERROR_404 - avatar
0
Oh yeah! so should it be 1 if i want the factorial?
22nd Jul 2019, 1:22 PM
ERROR_404
ERROR_404 - avatar