Loop Exercise

Name:  ______________________________________________________________________


"Trace" the for loop below by giving the values of i and the output.

final int MAX = 10;
for (int i = MAX; i > 0; i--)
  System.out.println(i * 10);

                   i                   output
              ----------       --------------------------
	    
	    
	    
	    
	    
	    
	    
	    





Show the output for the while loop below:

final int MAX = 60;
int x = 200;
System.out.println("x = " + x);	    
while ( x > MAX) {
  x /= 2;
  System.out.println("x = " + x);
}
System.out.println("x = " + x);	    

             output
   --------------------------