logo CodeStepByStep logo

You are working on problem set: Small Problems 4A ( Pause)

loop_mystery_exam3

Language/Type: C while return

For each call of the function below, write the output that is printed and the value that is returned:

int loop_mystery_exam3(int x, int y) {
    int z = x + y;
    while (x > 0 && y > 0) {
        x = x - y;
        y--;
        printf("%d %d ", x, y);
    }
    printf("%d\n", y);
    return z;
}
loop_mystery_exam3(7, 5) output
loop_mystery_exam3(7, 5) return
loop_mystery_exam3(20, 4) output
loop_mystery_exam3(20, 4) return
loop_mystery_exam3(40, 10) output
loop_mystery_exam3(40, 10) return

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? .

If something seems wrong with our site, please

Is there a problem? Contact us.