We use the logical function
Problem
Given a function that returns
true
if it is an even number and
false
if it is odd. Using this function, write a program that prompts the keyboard for a natural number, and if if it is odd, it displays the number
1
greater than the original number, otherwise it displays the original number itself.
Examples
# |
Input |
Output |
1 |
1 |
2 |
2 |
2 |
2 |