logo CodeStepByStep logo


Language/Type: C# recursion

For each call to the following recursive method, write the output that would be produced, as it would appear on the console.

public static void RecursionMysteryComma(int x, int y)
    if (y == 1)
        Console.Write((x * y) + ", ");
        RecursionMysteryComma(x, y - 1);
        Console.Write(", " + (x * y));
RecursionMysteryComma(4, 1);
RecursionMysteryComma(4, 2);
RecursionMysteryComma(8, 2);
RecursionMysteryComma(4, 3);
RecursionMysteryComma(3, 4);

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.