Find an integer is odd or even number using Python within 4 simple lines

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

Case-1

Enter any number: 6
6 is EVEN

Case-2

Enter any number: 5
5 is ODD


Detailed definition
  1.  Get input from the user using input().
  2. Conditional checking // if number divided by 2 and leaves a remainder 0.  (Even)
  3. if number divided by 2 and leaves any remainder other than 0.(Odd)
  • Any doubt you can comment and clarify your doubt. 

You may also check 

Simple Python Program to Add Two Numbers in Two methods-learn easily within 1 minute

Many easy Programs  Click here 

Post a Comment

If you any doubts, Please let me know

Previous Post Next Post