Review the for loop and equations quiz. 

Do this review in ONENOTE.

  1. In each of the while loops and for loops below, Color the initialization red, underline the condition/test , color the change or increment blue in each loop  

int x = 10;  

while ( x < 100 ) {  
   System.out.println( x );  
   x = x + 10;  

int sum =  0 ;  
int j   = -5 ;  
while ( sum <= 350 ) { 
      sum += j ; 
      j   += 5 ; 

for ( int x = 1; x < 6 ; x ++){ 

   System.out.print(x); 

for ( int z = 10; z >-1 ; z--){ 

   System.out.print(z); 

 

 

  1. Fill in the table of values for each equation based on the value of j 

j/10 

j % 10 

(j + 1.0)/10 

j / 10.0 

  

  

  

  

  

  

  

  

10 

  

  

  

  

 

  1. Write the output of this loop 

for ( int j = 0;  j < 9; j++ ) { 
    k = j + 2; 
    System.out.print( j + " " + k + " " ); 
    System.out.println( ); 

 

  1. What are the values of the variable as it goes through the loop while the condition is true, then what is it after the loop is over? 

  

Starting value 

last time 

after loop 

for (x=1; x<=4; x++) 

 

  

  

for (y=10; y>=5; y--) 

 

  

  

for (k=10; k<=15; k+=2) 

 

  

  

for ( j = 0;  j <  4; j++ )