7 Program on Greatest of three number in VB.NET using If-Else

Code:

Module Module1

    Sub Main()
        Dim num1, num2, num3, max, sum As Integer
        Console.WriteLine("Enter any 3 Number")

        num1 = Console.ReadLine()
        num2 = Console.ReadLine()
        num3 = Console.ReadLine()

        If num1 > num2 And num1 > num3 Then
            max = num1
        ElseIf num2 > num1 And num2 > num3 Then
            max = num2
        Else
            max = num3
        End If

        Console.WriteLine("Greatest Number is " & max)
        Console.ReadKey()
    End Sub

End Module


Output:



Previous
Next Post »