logo CodeStepByStep logo

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

recursionMystery11

Language/Type: Java recursion recursive tracing

For each call to the following method, indicate what value is returned:

public static int recursionMystery11(int n) {
    if (n < 0) {
        return -recursionMystery11(-n);
    } else if (n < 10) {
        return n;
    } else {
        return recursionMystery11(n / 10 + n % 10);
    }
}
recursionMystery11(6)
recursionMystery11(17)
recursionMystery11(259)
recursionMystery11(977)
recursionMystery11(-479)

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.