Write a program to add 'Whole numbers' upto 'n', where 'n' is given by a user and also write the output for it.
Answers
Answered by
0
Answer:
Explanation:
n = input(“Enter any number”) sum = 0 for i in range(i, n + 1): sum = sum + i print “sum = “ , sum Output: Enter any number 5 sum =15Read more on Sarthaks.com - https://www.sarthaks.com/1016709/write-a-program-to-display-sum-of-natural-numbers-upto-n
Similar questions