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

Google Advertisements
Download Projects

Google Adsense Advertisements

Buy 3 Year Old Domain, Tutorialday.com, SeosmoTools.com @$200

Buy This Ad Space @$50 per Month, Ad Size 300X250 Contact on: hitesh.xc@gmail.com WhatsApp no. 8882538826

Yahoo Advertisements