Write a Python Program to print the Sum of First N Natural Numbers


Topic: Write a Python Program to print the Sum of First N Natural Numbers

Solution

n=7
sum1 = 0
while(n > 0):
    sum1=sum1+n
    n=n-1
print("The sum of first n natural numbers is",sum1)



List all Python Programs