KnowledgeBoat Logo
|

Robotics & Artificial Intelligence

Write a program to find and display the sum of any ten natural numbers.

Python Control Flow

3 Likes

Answer

s = 0
print("Enter any ten natural numbers:")
for i in range(10):
    n = int(input())
    s = s + n
print("Sum of ten natural numbers =", s)

Output

Enter any ten natural numbers:
5
4
6
7
3
2
9
8
10
23
Sum of ten natural numbers = 77

Answered By

3 Likes


Related Questions