Python program to print even numbers using while loop
In this program, You will learn how to print even numbers using while loop in Python.
Some even list is : 2 4 6 8 10 12 14 16 18 20
Example: How to print even numbers using a while loop in Python.
x = int(input("Enter a number:"))
i = 1
while i <= x:
if i % 2 == 0:
print("Number is even:", i)
i = i + 1
Output:
Enter a number:10
Number is even: 2
Number is even: 4
Number is even: 6
Number is even: 8
Number is even: 10