Given number is even or odd




Check the given number is even or odd

                     Hello, In this post we see the python code to check the given number is even or odd.

Program:
num=int(input("enter the number to find even or odd....?\n"))
if (num%2)==0:
    print("the number is even")
else:
    print("the number is odd")

                    In above code, under if condition the print statement is written and i.e. important. In python this is known as indentation. If we create or write any condition or loop then that loop or condition related all the statements is under that condition and this is python rule. The output is like,

Output:
enter the number to find even or odd....?
78
the number is even

>>> 

enter the number to find even or odd....?
77
the number is odd
>>>




Given number is even or odd Given number is even or odd Reviewed by Amit Waghmare on November 09, 2019 Rating: 5

No comments: