Question
What is printed by each of these pieces of code? int x = 5; int y = 10; while (y > 1){ if (x +
What is printed by each of these pieces of code?
int x = 5;
int y = 10;
while (y > 1){
if (x + y > 16)
System.out.printin ("break");
break;
} do{
System.out.println("x: "+x+" y: "+y) ;
* = x + 3;
y = y - 2;
}while (x < 15) ;
}
b.
for (int i = 0; i < 10; i++){
if (i == 4) continue;
for (int j = i+1; j < 6; j++){
if (i > 3) continue;
System.out .println(": "+ i+" j: "+j); ?
What is printed by each of these pieces of code?
int x = 5;
int y = 10;
do {
System.out. println("do while: x: "+x+" y: "+y);
x = x + 3;
y = y - 2;
while (v > 7){
x++;
y--;
System.out.println("while: x: "+x+" y: "+y);
} while (x < 15);
b.
for (int i = 0; i < 4; i++){
System.out.print("i "+i);
for (int j = i-1; j >= -1; j--){
System.out.print(" j "+j);
}
System.out.println();
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started