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

10 comments:

  1. Awesome code thanks, you are the only one that realize that i need not the max value but the variable that has the max value so thanks again

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete