Question: Given the following method: public static void mystery(int x) { int y = 1; int z = 0; while (2 * y
Given the following method:
public static void mystery(int x) { int y = 1;
int z = 0;
while (2 * y <= x) { y = y * 2;
z++;
}
System.out.println(y + " " + z);
}
Write the output of each of the following calls.
| mystery(1); | |
| mystery(6); | |
| mystery(19); | |
| mystery(39); | |
| mystery(74); |
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
