For each of the following possible values of (count+1),
which branch of the first if
will be executed?
if
Statement
When (count+1)
is equal to 3,
the false branch
is executed.
if ( count+1 == 2 ) suffix = "nd" else if ( count+1 == 3 ) suffix = "rd"; else suffix = "th"; System.out.println( "Enter the " + (count+1) + suffix + " integer (enter 0 to quit):" );
The false branch consists of an if
statement.
When this nested if
statement is executed,
its true branch will execute,
selecting the String "rd" for suffix.
The next statement to execute is the println
.
What suffix is chosen if (count+1)
is equal to 5?