Menu Close

Print Odd Numbers in range

Write a program to print all the odd numbers between two ranges(Include the range too)

Refer sample input and output for formatting specification.

r1=int(input('Enter starting range: '))
r2=int(input('Enter ending range: '))
for i in range(r1,r2+1):
  if(i%2!=0):
    print(i)

Input_1:
Enter starting range: 1
Enter ending range: 11
Output:
1
3
5
7
9
11


Input_2:
Enter starting range: 24
Enter ending range: 38
Output:
25
27
29
31
33
35
37


Exec. on linux

Morae!Q!