Sum of the 'n th' natural number using programming language. This program will print the series with the sum of the natural number. The series is:
1,2,3,4,5,6,7,8, ...................
# Program to print the series and the sum.
# Here enter number up to which the natural will print.
n = int(input("Enter number:"))
sum = 0
for i in range (1,n+1) :
sum += i
print(i, end=',')
print("Sum of the numbers :",sum)
Commentaires