logo CodeStepByStep logo

parameter_mystery10

Language/Type: PHP parameter mystery parameters return
Author: Mehran Sahami (added by Melissa Hovik on 2018/01/05)

The following console program uses parameters and returns to produce three lines of output. What are they?

function bludger($y) {
    $x = intval($y / 1000);
    $z = ($x + $y);
    $x = quaffle($z, $y);
    print("bludger: x = $x, y = $y, z = $z\n");
}

function quaffle($x, $y) {
    $z = snitch($x + $y, $y);
    $y = intval($y / $z);
    print("quaffle: x = $x, y = $y, z = $z\n");
    return $z;
}

function snitch($x, $y) {
    $y = $x / ($x % 10);
    print("snitch: x = $x, y = $y\n");
    return $y;
}

bludger(2001);
line 1
line 2
line 3

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.