posted 18 years ago
The outer while loop will run three times, with i = 0, with i = 1, and then with i = 2.
The first time the do loop runs, it will run 4 times. with j = 0, with j = 1, with j = 2, and then with j = 3. The reason there seems to be an extra iteration is because the condition check for the do-loop is at the end.
The second and third time the do-loop runs, they will both run once each -- with j = 4, and with j = 5. Just as before, since the checking is at the end, it seems to run at least one extra iteration.
Henry