Program rationale

(Display Listing 1.)

The remainder produced by dividing an even integer by 2 will be zero.

The remainder produced by dividing an odd integer by 2 will not be zero.

Whether or not the value of the remainder is zero can be used to determine if the user input integer is even or odd.

That rationale is used in the selection structure to determine whether to display the word Even, as shown in Figure 5, or the word Odd as shown in Figure 6.