A Program to Check if a Number is Even or Odd
In this example, we are giving a program to check if a number is even or odd.
Program to swap to check if a number is even or odd:
# Check if a number is even or odd
num = float(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: 57 57.0 is Odd