Python program to print even and odd numbers from 1 to N; Through this tutorial, i am going to show you how to print even and odd numbers from 1 to N (10, 100, 500, 100).

In this tutorial i will show you how to print even and odd numbers using for loop, while loop, and without if statement.

## Python Program to Print Even and Odd numbers From 1 to N

Let’s see the python programs to print even and odd numbers from 1 to N (10, 100, 500, 1000):

- Algorithm to print even and odd numbers from 1 to N
- Python Program to Print Odd Numbers from 1 to N using For Loop
- Python Program to Print Odd Numbers from 1 to N without If
**Statement** - Python Program to Print Odd Numbers using While Loop
- Python Program to Print Even Numbers from 1 to N using For Loop
- Python Program to Print Even Numbers from 1 to N without If Statement
- Python Program to Print Even Numbers from 1 to N using While Loop

### Algorithm to print even and odd numbers from 1 to N

- Allows the user to enter the maximum limit value using python input() function.
- Iterate for loop or while loop of n number value.
- inside loop or while loop; Use the conditional statement to specify this number is even or odd.
- Then print even and odd numbers from 1 to the user entered a maximum limit value.

### Python Program to Print Odd Numbers from 1 to N using For Loop

# Python Program to Print Odd Numbers from 1 to N num = int(input(" Please Enter any Maximum Number : ")) for number in range(1, num + 1): if(number % 2 != 0): print("{0}".format(number))

**Output of the above program; as shown below:**

Please Enter any Maximum Number : 10 1 3 5 7 9

### Python Program to Print Odd Numbers from 1 to N without If Statement

# Python Program to Print Odd Numbers from 1 to N wihtout using if statement num = int(input(" Please Enter any Maximum Number : ")) for number in range(1, num + 1, 2): print("{0}".format(number))

** Output of the above program; as shown below: **

Please Enter any Maximum Number : 10 1 3 5 7 9

### 3: Python Program to Print Odd Numbers using While Loop

# Python Program to Print Odd Numbers from 1 to N using while loop num = int(input(" Please Enter the Maximum Value : ")) number = 1 while number <= num: if(number % 2 != 0): print("{0}".format(number)) number = number + 1

** Output of the above program; as shown below: **

Please Enter any Maximum Number : 10 1 3 5 7 9

### Python Program to Print Even Numbers from 1 to N using For Loop

# Python Program to Print Even Numbers from 1 to N using for loop num = int(input(" Please Enter the Maximum Number : ")) for number in range(1, num+1): if(number % 2 == 0): print("{0}".format(number))

** Output of the above program; as shown below: **

Please Enter the Maximum Number : 10 2 4 6 8 10

### Python Program to Print Even Numbers from 1 to N without If Statement

# Python Program to Print Even Numbers from 1 to N without using if statement num = int(input(" Please Enter the Maximum Value : ")) for number in range(2, num+1, 2): print("{0}".format(number))

** Output of the above program; as shown below: **

Please Enter the Maximum Number : 10 2 4 6 8 10

### Python Program to Print Even Numbers from 1 to N using While Loop

# Python Program to Print Even Numbers from 1 to N using while loop num = int(input(" Please Enter the Maximum number : ")) number = 1 while number <= num: if(number % 2 == 0): print("{0}".format(number)) number = number + 1

** Output of the above program; as shown below: **

Please Enter the Maximum Number : 10 2 4 6 8 10

## Recommended Python Tutorials

**Recommended:-**Python Program to Add Two Numbers

**Recommended:-**Python Program to Calculate Simple Interest

**Recommended:-**Python Program to Find Average of n Numbers

**Recommended:-**Python Program to ASCII Value of Character

**Recommended:-**Python Program to Calculate Compound Interest

**Recommended:-**Python Program to Check Leap Year

**Recommended:-**Python Program To Print Number Pattern

**Recommended:-**Python Program to Print Star Pattern

**Recommended:-**Python Replace Character in String

**Recommended:-**Python Convert String to Float

**Recommended:-**Python String translate() Method Example

**Recommended:-**Python Convert String to List

**Recommended:-**Python filter() Method

**Recommended:-**Python Map() Method

**Recommended:-**Python String Append

## Be First to Comment