The selection structure in code

The next program named Structures02 illustrates the use of a selection structure as one of the elements in a sequence structure.

A complete listing of this program is shown in Listing 10.

The user is asked to enter an integer and then the selection structure uses the value of the integer to make a decision.

The decision is used to display one or the other of two different messages. 

The decision is made on the basis of whether the user input is even or odd.