Header Ads

Python Program to Print Even Number From 1 to 100 Using While Loop


Write a Python Program to Display Even Number Between 1 to 100 using While Loop

Example: Code Program



n = 1while n <= 100:
    if n%2 == 0:
        print(n, end=" ")
    n = n+ 1

Output



If You Want the Program asked You to given Specific Range and Display Even Number of Those Range

Example: Code Program


l = int(input("Enter Starting Numbeer:"))
h =
int(input("Enter Ending Number:"))
print("Print Even Number Between ",l," and ",h)
for n in range(l,h+1):
   
if n%2 == 0:
       
print(n,end=",")
Output:

Related Python Program
Python Program to Check Whether a Number is Prime or Not

No comments

Powered by Blogger.