logo CodeStepByStep logo

IfElseMystery2

Language/Type: VB if/else mod mystery

For each call to the following function, indicate what output is produced.

Public Sub Mystery2(a As Integer, b As Integer)
    If a Mod b = 0
        a = a \ b
        If a < b
            b = b - a
        End If
    ElseIf b Mod 2 = 0
        b = b \ 2
    Else
        a = a - b
    End If
    Console.WriteLine(a & " " & b)
End Sub
Mystery2(20, 4)
Mystery2(7, 6)
Mystery2(14, 7)
Mystery2(24, 8)
Mystery2(13, 9)

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.