Python program to find the sum of n natural numbers


Write a program in python to find the sum of n natural numbers

------------------------------------

num=int(input("Enter the Limit : "))

s=0

for i in range(1,num+1):

    s=s+i

print("The sum is : ",s)

------------------------------------

Output :-

Enter the Limit : 5

The sum is :  15

Post a Comment

0 Comments