Sunday 13 November 2016

Find an input number is odd or even using Python. Simple program

This program will find an input number is odd or even using Python.

code:

x = int(raw_input("Enter a number: "))
if (x%2 == 0):
        print "%d is Even" % x
else:
        print "%d is Odd" % x


Know how to run python code 

Output: 

$ python odd_even.py
Enter a number: 5
5 is Odd

$ python odd_even.py
Enter a number: 54
54 is Odd


No comments:

Post a Comment