Dremendo Tag Line

Find sum of all 3 digit even numbers using while loop in Python

while Loop - Question 2

In this question, we will see how to find the sum of all 3 digit even numbers in Python programming using while loop. To know more about while loop click on the while loop lesson.

Q2) Write a program in Python to find the sum of all 3 digit even numbers using while loop.

Program

i=100; s=0
while i<=999:
    s=s+i
    i=i+2

print('Sum of all 3 digit even numbers = %d' %(s))

Output

Sum of all 3 digit even numbers = 247050
video-poster