Question: Use the code below to answer the matching questions which follow int cntr; int total; int twoBack = 1; cntr = 0; while (cntr
Use the code below to answer the matching questions which follow
int cntr;
int total;
int twoBack = 1;
cntr = 0;
while (cntr <= 10){
twoBack = cntr - 2;
cntr++;
}
System.out.println("Loop A: " + twoBack);
cntr = 1;
while (cntr <= 4){
if (cntr % 2 == 3) cntr *= cntr;
cntr += cntr;
}
System.out.println("Loop B: " + cntr);
total = 0;
for (cntr = 5; cntr >= -5; cntr--){
total += cntr;
}
System.out.println("Loop C: " + total);
total = 0;
cntr = 10;
while(cntr<=15) {
total += cntr;
cntr += 5;
}
System.out.println("Loop D: " + total);
Indicate the output which would be produced by the above code by matching the correct answer to the question. Note: Not all answers will be used and a given answer maybe used more than once.
|
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
