by BehindJava
Write a program to check if a Number is odd or even
In this tutorial we are going to learn about writing a program to check if a Number is odd or even.
program to demonstrate the given number is odd or even
Odd Number: A number is said to be odd only if the gives the remainder one when divided by two. Even Number: A number is said to be even only if the gives the remainder zero when divided by two.
Method 1:
num=8
if (num%2==0):
print("Even")
else:
print("odd")
Method2:
num=9
if (num%2==0):
print("Even")
else:
print("odd")