logo CodeStepByStep logo

You are working on problem set: Unit 4 ( Pause)

mystery1

Language/Type: Java recursion recursive tracing

For each call to the following method, indicate what console output is produced:

public static void mystery1(int k) {
    if (k <= 1) {
        System.out.print(k);
    } else {
        mystery1(k / 2);
        System.out.print(" = " + k);
    }
}
mystery1(1);
mystery1(4);
mystery1(16);
mystery1(30);
mystery1(100);

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? .

If something seems wrong with our site, please

Is there a problem? Contact us.