python script to check whether the number is even or odd

#python program to check whether the number is even or odd

num=int(input("Enter the number"))
if(num%2==0):
         print("The number is even")
else:
        print("the number is odd")




"""python program to check whether the number is even or odd without using % operator"""

num=int(input("Enter the number"))
if((num//2)*2==num):
    print("the number is even")
else:
    print("the number is odd")



Comments

Post a Comment