Suppose a user executes the following run() method
and types the numbers 3.
public static void run() {
int n = IO.readInt();
int i = 0;
while(n != 1) {
if(n % 2 == 1) n = 3 * n + 1;
if(n % 2 == 0) n /= 2;
i++;
}
IO.println(i);
}
Show all the values taken on by the variables of the
program.
What does the method print?n i
n 3 10 5 16 8 4 2 1 i 0 1 2 3 4 5It prints ``5.''