Skip to main content

Posts

Showing posts with the label #odd numbers in range in python

Python program to display odd numbers in range x , y

 Python program to print odd numbers in between x and y. Odd numbers: The numbers which are not divisible by 2 or the numbers whose remainder is  1 are called odd numbers. Input : enter x value  5 enter y value 10 Output :  odd numbers between 5 and 10 are 5 7 9  Python program to display odd numbers in range x , y #program to print odd numbers in range x and y x=int(input("enter x ")) y=int(input("enter y ")) print(f"odd 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 5 enter y 10 odd numbers in between1 and 5 are 5 7 9