Programming Examples
Python program to find the sum of n natural numbers
WAP to find the sum of n natural numbers.
Solution
#WAP to find the sum of n natural numbers.
n=int(input("Enter the Limit : "))
s=0
for i in range(1,n+1):
s=s+i
print("The sum is : ",s)
Output
Enter the Limit : 4
The sum is : 10