Python program to print Even numbers in between x and y.
Even numbers:
The numbers which are divisible by 2 or the numbers whose remainder is 0 are called even numbers.
Input :
enter x value 1
enter y value 7
Output :
even numbers between 1 and 7 are
2
4
6
Python program to display even numbers in range x , y
#program to print even numbers in range x and y
x=int(input("enter x "))
y=int(input("enter y "))
print(f"even numbers in between{x} and {y} are ")
for i in range(x,y):
if i%2==0:
print(i) #use i,end=' ' to get output in single line
Output :
enter x 1
enter y 7
even numbers in between1 and 5 are
2
4
6
Comments
Post a Comment
Type Your Comments !
Please do not enter any spam link in the comment box.