Dremendo Tag Line

Input 10 numbers and find the sum of 2 digit positive numbers using for loop in Python

for Loop - Question 6

In this question, we will see how to input 10 numbers and find the sum of 2 digit, positive numbers only in Python programming using for loop. To know more about for loop click on the for loop lesson.

Q6) Write a program in Python to input 10 numbers and find the sum of 2 digit, positive numbers only using for loop.

Program

s=0
print('Enter 10 numbers')
for i in range(1,11):
    n=int(input())
    if n>=10 and n<=99:
        s=s+n
print('Sum of 2 digit positive numbers = %d' %(s))

Output

Enter 10 numbers
2
4
18
20
1
9
3
5
32
46
Sum of 2 digit positive numbers = 116
video-poster