Python Program to Find the Sum of Natural Numbers
In this article, You will learn about python program to find the sum of natural numbers
Formula:
n*(n+1)/2
Program:
n=16
sum = n*(n+1)/2
print("sum of natural numbers",sum)
Output:
By using dynamic variables:
n=int(input("enter value"))
sum = n*(n+1)/2
print("sum of natural numbers",sum)
Output:
enter value20 sum of natural numbers 210.0