Even Numbers

Any integer that can be divided exactly by 2 is an even number.
The last digit is 0, 2, 4, 6 or 8

Odd Numbers
Any integer that cannot be divided exactly by 2 is an odd number.
The last digit is 1, 3, 5, 7 or 9

 code:-

num = int(input("Enter a number: "))
mod = num % 2
if mod > 0:
    print("This is an odd number.")
else:
    print("This is an even number.")

output 1:-

Enter a number: 7

This is an odd number.


output 2:-

Enter a number: 6

This is an even number.

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post