Prog1 Final Exam Batch 2
Odd and
Even Detection
Write a program that will ask a number
and display whether it is odd or even.
ENTER
A NUMBER: 27
IT
IS ODD.
ENTER
A NUMBER: 4
IT
IS EVEN.
ENTER
A NUMBER: 24
IT
IS EVEN.
ENTER
A NUMBER: A
INVALID INPUT
ENTER
A NUMBER: 0
GOODBYE
The program will keep prompting the
user for a number.
If the user enters an invalid input
(e.g. a letter or a number with decimal value), it will print “INVALID INPUT”.
0 comments:
Post a Comment