Computer Science, asked by ranjitranjitdhir, 2 months ago

write a program to display the sum of numbers from 50 to 1​

Answers

Answered by shwetajaiswar169
0

Answer:

•) The given co‎de is written in Python 3. s=0.

•) For i in range(1,51): s+=i print("Sum of numbers from 1 to 50 is:",s)

OR,

•) Print("Sum of numbers from 1 to 50 is:",s) Logic: •) Initialise s = 0. Loop through numbers in the range 1 to 50.

•)Add up the numbers and store in s. Display the value of s at last.

Similar questions