Answers for "Accept number from user and calculate the sum of all number from 1 to a given number"

0

Accept number from user and calculate the sum of all number from 1 to a given number

n = int(input("Enter number"))
sum = 0
for num in range(1, n + 1, 1):
    sum = sum + num
print("Sum of numbers is: ", sum)
Posted by: Guest on June-03-2021

Code answers related to "Accept number from user and calculate the sum of all number from 1 to a given number"

Browse Popular Code Answers by Language