Odd Even number Program in Python

Advertisements

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 Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements