/**  Loops Practice Test                                           name _________________________ */
public class LoopsPractice{
public static void main( ) {
int x = 0, y = 0, z = 1, n1 = 2, n2 = 2, t = 0;
// Give the values of the variables after the loops hav run.///////////////////////////////
for (x=0; x<=n1; x++) {
for (y=0; y<=n2; y++) {
z += 2;
t += 2;
}
}
System.out.println ("1) x = "+x  +";  y = "+y  +";  z = "+z  +";  t = "+t );
//
//1) x = ________    y = ________    z = ________   t = ________

n1 = 2; n2 = 2; z = 4; t = 0;
for (x=0; x<=n1; x++) {
for (y=0; y<=n2; y++) {
z *= 2;
t = y;
}
}
System.out.println ("2) x = "+x  +";  y = "+y  +";  z = "+z  +";  t = "+t );
//
//2) x = ________    y = ________    z = ________   t = ________

n1 = 2; n2 = 3; z = 1; t = 0;
for (x=1; x<=n1; x++) {
t=0;
for (y=1; y<=n2; y++) {
z += y;
t++;
}
}
System.out.println ("3) x = "+x  +";  y = "+y  +";  z = "+z  +";  t = "+t );
//
//3) x = ________    y = ________    z = ________   t = ________

n1 = 2; n2 = 2; z = 1; t = 5;
for (x=1; x<=n1; x++) {
for (y=1; y<=n2; y++) {
z *= y + x;
t++;
}
}
System.out.println ("4) x = "+x  +";  y = "+y  +";  z = "+z  +";  t = "+t );
//
//4) x = ________    y = ________    z = ________   t = ________

n1 = 2; n2 = 2; z = 1; t = 0;
for (x=1; x<=n1; x++) {
for (y=1; y<=n2; y++) {
t= 2*t;
z += y * x;
if (z > 3) {
z = 2;
break;
}
}
}
System.out.println ("5) x = "+x  +";  y = "+y  +";  z = "+z  +";  t = "+t );
//
//5) x = ________    y = ________    z = ________   t = ________

n1 = 2; n2 = 3; z = 1; t = 0;
for (x=0; x<=n1; x++) {
for (y=0; y<=n2; y++) {
z *= y;
t *= t;
}
t++;
}
System.out.println("6) x = "+x  +";  y = "+y  +";  z = "+z  +";  t = "+t );
//
//6) x = ________    y = ________    z = ________   t = ________

n1 = 2; n2 = 2; z = 1; t = 0;
for (x=1; x<=n1; x++) {
for (y=1; y<=n2; y++) {
z *= x;
}
t = x;
}
System.out.println ("7) x = "+x  +";  y = "+y  +";  z = "+z  +";  t = "+t );
//
//7) x = ________    y = ________    z = ________   t = ________

n1 = 2; n2 = 3; z = 1; t = 0;
for (x=1; x<=n1; x++) {
t *= 27;
for (y=1; y<=n2; y++) z += t;
}
System.out.println ("8) x = "+x  +";  y = "+y  +";  z = "+z  +";  t = "+t );
//
//8) x = ________    y = ________    z = ________   t = ________

System.out.println (" ");

// Write the output for the following:
//9)
n1 = 4; n2 = 3;
for (x=0; x<n1; ++x) {
for (y=n2; y<0; y--) System.out.print (" x");
System.out.println (" ");
}
System.out.println (" ");
}
}