Answer to Question #203939 in Visual Basic for JoshColl

Question #203939

Create a program to determine the largest of three numbers entered by a user.


1
Expert's answer
2021-06-06T12:59:30-0400
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





Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS