Exercise
Hexadecimal and binary
Objetive
Write a Visual Basic (VB.Net) program to ask the user for a number an display it both in hexadecimal and binary. It must repeat until the user enters 0.
Code
Imports System
Public Class exercise68
Public Shared Sub Main()
Dim n As Integer
Do
Console.Write("Enter a number:")
n = Convert.ToInt32(Console.ReadLine())
If n <> 0 Then
Console.Write("Hexadecimal: ")
Console.WriteLine(Convert.ToString(n, 16))
Console.Write("Binary: ")
Console.WriteLine(Convert.ToString(n, 2))
End If
Loop While n <> 0
End Sub
End Class