Write a Python program using functions to check whether a number is even or odd | computer practical

Опубликовано: 05 Август 2026
на канале: Educrawl
196
5

#educrawl #education #python #program

Write a program using functions to check whether a number is even or odd
Odd or Even

AIM :

Create a program using functions to check whether a number is even or odd

Source Code:
def oddeven(a):
if(a%2==0):
return 1
else:
return 0
num = int(input("Enter a number: "))
if(oddeven(num)==1):
print("The given no is Even")
elif(oddeven(num)==0):
print("The given no is Odd")

Result:
Thus the above program is executed and the required output is obtained.

Enter a number: 12
The given no is Even

Enter a number: 11
The given no is Odd