logo CodeStepByStep logo

recursionMystery11

Language/Type: C++ recursion

For each call to the following recursive function, write the output that is produced as it would appear on the console.

void recursionMystery11(int x) {
    if (x < 10) {
        cout << "[" << x << "] ";
    } else {
        cout << x << " ( ";
        recursionMystery11(x / 2);
        cout << " , ";
        recursionMystery11(x % 2);
        cout << " ) ";
    }
}
recursionMystery11(17);
recursionMystery11(31);
recursionMystery11(62);

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.