Create a program to determine the largest of three numbers entered by a user.
Module Module1
Sub Main()
Dim x As Integer
Console.Write("Enter the number 1: ")
Integer.TryParse(Console.ReadLine(), x)
Dim y As Integer
Console.Write("Enter the number 2: ")
Integer.TryParse(Console.ReadLine(), y)
Dim z As Integer
Console.Write("Enter the number 3: ")
Integer.TryParse(Console.ReadLine(), z)
Dim largest As Integer = x
Dim middle As Integer = y
Dim smallest As Integer = z
If (x < y) Then
largest = y
smallest = x
Else
largest = x
smallest = y
End If
If (largest < z) Then
largest = z
End If
If (smallest > z) Then
smallest = z
End If
Console.WriteLine("The largest of three numbers: " + largest.ToString())
Console.ReadLine()
End Sub
End Module
Comments
Leave a comment