Powered by Blogger.
RSS

lol

Recommend Us On Google
Like Us On Facebook

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

Find The Highest and Lowest of 6 Numbers in Visual Basic 6.0




Private Sub Command1_Click()
Dim a, b, c, d, e, f As Double
Dim x, y As Double

a = Val(Text1)
b = Val(Text2)
c = Val(Text3)
d = Val(Text4)
e = Val(Text5)
f = Val(Text6)




If a >= b And a >= c And a >= d And a >= e And a >= f Then
x = a
ElseIf b >= a And b >= c And b >= d And b >= e And b >= f Then
x = b
ElseIf c >= a And c >= b And c >= d And c >= e And c >= f Then
x = c
ElseIf d >= a And d >= b And d >= c And d >= e And d >= f Then
x = d
ElseIf e >= a And e >= b And e >= c And e >= d And e >= f Then
x = e
Else
x = f
End If


If a <= b And a <= c And a <= d And a <= e And a <= f Then
y = a
ElseIf b <= a And b <= c And b <= d And b <= e And b <= f Then
y = b
ElseIf c <= a And c <= b And c <= d And c <= e And c <= f Then
y = c
ElseIf d <= a And d <= b And d <= c And d <= e And d <= f Then
y = d
ElseIf e <= a And e <= b And e <= c And e <= d And e <= f Then
y = e
Else
y = f
End If




Label4.Caption = "The Highest is : " & x
Label5.Caption = "The Lowest is : " & y
End Sub

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS