This program will find an input number is odd or even using Python.
if (x%2 == 0):
print "%d is Even" % x
else:
print "%d is Odd" % x
Know how to run python code
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