logo CodeStepByStep logo

recursion_mystery6

Language/Type: PHP recursion recursion mystery

For each call to the following recursive function, write the value that would be returned.

function recursion_mystery6($x, $y) {
    if ($x < $y) {
        return $x;
    } else {
        return recursion_mystery6($x - $y, $y);
    }
}
recursion_mystery6(6, 13)
recursion_mystery6(14, 10)
recursion_mystery6(37, 10)
recursion_mystery6(8, 2)
recursion_mystery6(50, 7)

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.