Pages

Search This Blog

Find the greatest among 3 integers


Module Greatest_nested
    Sub main()
        Dim a, b, c As Integer
        Console.Write("Enter the values of a,b and c :")
        a = CInt(Console.ReadLine())
        b = CInt(Console.ReadLine())
        c = CInt(Console.ReadLine())
        If a > b Then
            If a > c Then
                Console.WriteLine("Greatest=" + a.ToString())
            Else
                Console.WriteLine("Greatest=" + c.ToString())
            End If
        Else
            If b > c Then
                Console.WriteLine("Greatest=" + b.ToString())
            Else
                Console.WriteLine("Greatest=" + c.ToString())
            End If

        End If

        Console.ReadLine()
    End Sub
End Module

9 comments: