Accept number from user and calculate the sum of all number from 1 to a given number code example
Example: 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)