How to solve this problem without the use of if-else statements?
- by kira
I have just started my C++ lecture class. And the teacher has given us the following assignment.
Write a program that determines whether a number is even or odd.
The logic I would use for the program is.
Get input a.
Store a % 2 as b.
If b is 0, then b is even, else b is odd.
The catch though, is that we have to write the program without the use of a if-else statement.
I have been thinking on how to approach the problem for the past few hours, but I have no clue what to do. Any hints or suggestions?