Python program to print even and odd numbers from 1 to N(10, 50 100, 1000); Through this tutorial, you will learn how to print even and odd numbers from 1 to N (10, 100, 500, 1000) using the function, for loop, while loop and if-else statement.

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

- 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

- Use the python input() function that allows the user to enter the maximum limit value.
- Next, Run for a loop and Add the current value of n to num variable.
- Next, Python is going to print even and odd numbers from 1 to the user entered a maximum limit value.

### 1: 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**

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

**Recommended:-**Python Program to Reverse a Numbers

### 2: 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**

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

**Recommended:-**Python Program to Find Largest/Maximum of n Numbers

### 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**

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

**Recommended:-**Python Program to Print Numbers Divisible by 3, 5, 7

### 4: **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**

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

**Recommended:-**Python Program to Calculate Cube of Number

### 5: **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**

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

### 6: **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**

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

## Recommended Python Programs

**Recommended:-**Python Program to Find/Calculate Sum of n Numbers

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

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

**Recommended:-**Leap Year Program in Python

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

**Recommended:-**Number Pattern Programs in Python