Write a Python Program to Check if a Number is Odd or Even

Python Program to Check if a Number is Odd or Even

Welcome to the World of Online Learning:

Hello Friends “This blog helps you to learn  Python programming concepts. You can learn Python language at your own speed and time. One can learn concepts of Python language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Python Program to Check if a Number is Odd or Even
Python Program to Check if a Number is Odd or Even

Write a Python Program to Check if a Number is Odd or Even

PROGRAM: Python Program to Check if a Number is Odd or Even

/* Python Program to Check if a Number is Odd or Even */

# Python program to check if the input number is odd or even.
# A number is even if division by 2 gives a remainder of 0.
# If the remainder is 1, it is an odd number.

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

OUTPUT :-

Enter a number: 43
43 is Odd
Enter a number: 18
18 is Even

Leave a Reply

Your email address will not be published. Required fields are marked *