[solved]-Consider Following Methods Public Static Void Main String Args Loop 10 Public Static Void Q39061529
Consider the following methods:
public static void main(String[] args) {
loop(10); }
public static void loop(int n) {
int i = n;
while (i > 1) {
System.out.println(i);
if (i % 2 == 0) {
i = i / 2;
} else {
i = i + 1;
}
}
}
-
Draw a table that shows the value of the variables i and nduring the execution of loop. The table should contain one columnfor each variable and one line for each iteration.
-
What is the output of this program?
-
Can you prove that this loop terminates for any positive valueof n?
Expert Answer
Answer to Consider the following methods: public static void main(String[] args) { loop(10); } public static void loop(int n) { in… . . .
OR

