logo CodeStepByStep logo

recursionMystery13

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 recursionMystery13(int x, int y) {
    if (x <= 0 && y <= 0) {
        cout << ":";
    } else {
        cout << y % 10;
        recursionMystery13(x / 10, y / 10);
        cout << x % 10;
        cout << x % 10;
    }
}
recursionMystery13(8, 5);
recursionMystery13(12, 34);
recursionMystery13(51, 867);
recursionMystery13(27153, 604);

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.