# Python Program to Check If a Number is Odd or Even using If-else Statement

ADVERTISEMENTS

__Python__ program to check if a number is odd or even using if-else statement. In this article, you will learn how to make a python program to check if a number is odd or even using if-else statement.

## What is even odd numbers?

There is if any integer number divided by 2 and its reminder equals zero then it is an even number and the reminder is greater than zero then it is an odd number.

## Samples of even odd Numbers

**Even Numbers**: 0, 2, 4, 6, ...

**Odd Numbers**: 1, 3, 5, 7, ...

### Source Code

```
# Python Program to Check If a Number is Odd or Even using If-else Statement
print ("Enter an integer number to check:\n")
x = int (input ())
if (x % 2 == 0):
print ("The input number is even.\n")
else:
print ("The input number is odd.\n")
```

### Output

`Enter an integer number to check:`

34

The input number is even.

## Python Program to Check If a Number is Odd or Even using Ternary Operator

```
# Python Program to Check If a Number is Odd or Even using Ternary Operator
print ("Enter an integer number to check:\n")
x = int (input ())
x = 1 if x % 2 == 0 else 0
if (x):
print ("The input number is even.\n")
else:
print ("The input number is odd.\n")
```

### Output

`Enter an integer number to check:`

35

The input number is odd.