logo CodeStepByStep logo

RecursionMystery2

Language/Type: VB recursion

For each of the calls to the following recursive function below, indicate what output is produced:

Public Sub RecursionMystery2(n As Integer)
    If n <= 1
        Console.Write(": ")
    Else
        Console.Write((n Mod 2) & " ")
        RecursionMystery2(n \ 2)
        Console.Write(n & " ")
    End If
End Sub
RecursionMystery2(8)
RecursionMystery2(25)
RecursionMystery2(46)

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.