logo CodeStepByStep logo


Language/Type: PHP recursion recursion mystery

Given the function below, what is the output of the following call?

function mystery($n) {
    if ($n < 10) {
        return $n;
    } else {
        $a = intval($n / 10);
        $b = $n % 10;
        return mystery($a + $b);
(order shuffled)

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.