logo CodeStepByStep logo

IfElseMystery1

Language/Type: VB if/else

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

Public Sub Mystery(n As Integer)
    Console.Write(n & " ")
    If n > 0
        n = n - 5
    End If
    If n < 0
        n = n + 7
    Else
        n = n * 2
    End If
    Console.WriteLine(n)
End Sub
Mystery(8)
Mystery(-3)
Mystery(1)
Mystery(0)

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.