Odd Even number Program in Python


Prev Tutorial Next Tutorial

Check Odd Even number Program in Python

Using modulus Operator we can check odd and even number. If remainder is zero 'Even number' other wise odd number.

Odd Even number Program in Python

num = int(input("Enter any number: "))  
rem = num % 2  
if rem > 0:  
    print("Odd number.")  
else:  
    print("Even number.")  

Output 1

	
Enter any number: 24
Even number

Output 2

	
Enter any number: 25
Odd number

Odd Even number Program in Python

num = int(input("Enter any number: "))
if (num % 2) == 0:
   print("{0} is Even".format(num))
else:
   print("{0} is Odd".format(num))

Output 1

	
Enter any number: 12
12 is Even number

Output 2

	
Enter any number: 13
13 is Odd number

Prev Tutorial Next Tutorial

Advertisements
z
Download Projects

Advertisements

Download WhatsApp Status Video

Buy This Ad Space Only $50 per Month, Ad Size 300X250 Contact on: [email protected] WhatsApp no. 8882538826

Google Adsense Advertisements