Iteration

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   hear noise   go to next page

Answer:

count == 11 and increment == 2 will work, as will many others.

Iteration

Here is a flowchart of the program:

example loop

Each execution of a loop body is called an iteration. Sometimes the general concept of looping is also called iteration. In a counting loop, each iteration changes an integer loop control variable by an integer amount. The amount of change can be positive or negative.

QUESTION 5:

Say that during a run of a program, the body of a loop was exectued 5 times. How many times was the conditional part of the while statement evaluated?