Print Odd Numbers Within a Given Range in Python – Programming, Pseudocode Example, C# Programming Example
Python 3

Print Odd Numbers Within a Given Range in Python

This is a Python Program to print odd numbers within a given range.

The program takes the upper and lower limit and prints all odd numbers within a given range.

Here is the source code of the Python Programto print odd numbers within a given range. The program output is also shown below.

Program Explanation

1. User must enter the upper range limit and the lower range limit.
2. The for loop ranges from the lower range limit to the upper range limit.
3. The expression within the if-statement checks if the remainder obtained when the number divided by 2 is one or not (using the % operator).
4. If the remainder isn’t equal to 0, the number is odd and hence the number is printed.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.