Sounds like a good place for an if-else statement.
Here is the not-quite finished program:
The loop body in this program contains an if
statement.
This is fine.
An if
statement inside of a loop body is called a nested if.
There is nothing special about it; it works just as it would
outside of the loop body.
Fill in the four blanks to finish the program.
(Hint: use the remainder operator, %
in
the if
statement.
The remainder of an odd number divided by two is one.)