program to find a maximum value from five
values.
-----------------------------------------code---------------------------------------------------------
Public Class Form1
Private Sub
Button1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button1.Click
Dim n1,
n2, n3, n4, n5 As Integer
n1 = TextBox1.Text
n2 = TextBox2.Text
n3 = TextBox3.Text
n4 = TextBox4.Text
n5 = TextBox5.Text
If n1
> n2 And n1 > n3 And
n1 > n4 And n1 > n5 Then
TextBox7.Text = n1
ElseIf
n2 > n3 And n2 > n4 And n2 > n5 Then
TextBox7.Text = n2
ElseIf
n3 > n4 And n3 > n5 Then
TextBox7.Text = n3
ElseIf
n4 > n5 Then
TextBox7.Text = n4
Else
TextBox7.Text = n5
End If
If n1
< n2 And n1 < n3 And
n1 < n4 And n1 < n5 Then
TextBox6.Text = n1
ElseIf
n2 < n3 And n2 < n4 And n2 < n5 Then
TextBox6.Text = n2
ElseIf
n3 < n4 And n3 < n5 Then
TextBox6.Text = n3
ElseIf
n4 < n5 Then
TextBox6.Text = n4
Else
TextBox6.Text = n5
End If
End Sub
End Class
No comments:
Post a Comment