Python program to print sum of n natural numbers



a=int(input("Enter a number: "))

sum = 0

while(a > 0):

sum=sum+a

a=a-1

print("The sum of natural numbers is",sum)



23 views0 comments

Recent Posts

See All
 

9555593818

Thakurdwara, Uttar Pradesh 244601, India

  • Facebook
  • Twitter
  • LinkedIn