Sunday, January 29, 2017

Maximum of Three Numbers in Visual Basic NET

Here is a sample program that I wrote using Microsoft Visual Basic NET that will ask the user to give three numbers and then it will check which of the three numbers is the maximum in terms of numerical value.  The code is very short and easy to understand. Thank you.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.




Sample Program Output


Program Listing

Public Class Form1

    Function Maximum(ByVal valueOne As Double, _
       ByVal valueTwo As Double, ByVal valueThree As Double) _
       As Double
        Return Math.Max(Math.Max(valueOne, valueTwo), valueThree)
    End Function
  
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        End
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim val1, val2, val3 As Integer

        val1 = Val(TextBox1.Text)
        val2 = Val(TextBox2.Text)
        val3 = Val(TextBox3.Text)

        Label4.Text = "The biggest number is " & Maximum(val1, val2, val3) & "."
    End Sub
End Class






No comments:

Post a Comment