go to previous page   go to home page   go to next page hear noise

Answer:

Yes. Deciding which way you want to do it is part of coordinating the three parts of a counting loop. It is easy to get confused about this.


Confusing Loops

Look at the following program fragment:

int count     = 13;
int decrement = -1;
while ( count >= 0 )   // GREATER-than-or-equal operator
{
  System.out.println( "count is:" + count );
  count = count - decrement;
}
System.out.println( "Count was " + count + " when it failed the test");

Look over each of the three parts of the counting loop.


QUESTION 8:

What will this program fragment print when it is run?


go to previous page   go to home page   go to next page