Find an integer is odd or even number using Python
- Now i am going to show how to find an integer is odd or even number using python.
- Only 4 steps you can learn so stay tuned.
Sample Program to find an integer is odd or even
number = int(input('Enter any number: ')) // input() function
if number % 2 == 0: // Conditional checking
print(number, "is EVEN") // display() function
else:
print(number, "is ODD")
Output if number % 2 == 0: // Conditional checking
print(number, "is EVEN") // display() function
else:
print(number, "is ODD")
Case-1
Enter any number: 66 is EVEN
Case-2
Enter any number: 55 is ODD
- Get input from the user using input().
- Conditional checking // if number divided by 2 and leaves a remainder 0. (Even)
- if number divided by 2 and leaves any remainder other than 0.(Odd)
- Any doubt you can comment and clarify your doubt.