Option Explicit
Private num(4) As Integer
Private Sub Command1_Click()
Dim i As Integer
Randomize
For i = 0 To 4 Step 1
num(i) = Int(Rnd() * (20) + 1)
Next i
Text1.Text = num(0)
Text2.Text = num(1)
Text3.Text = num(2)
Text4.Text = num(3)
Text5.Text = num(4)
End Sub
Private Sub Command2_Click()
Dim min As Integer
Dim i As Integer
min = num(0)
For i = 1 To 4 Step 1
If min > num(i) Then
min = num(i)
End If
Next i
Label1.Caption = "최솟값은 " & min & " 이다"
End Sub
Private Sub Command3_Click()
Dim max As Integer
Dim i As Integer
max = num(0)
For i = 1 To 4 Step 1
If max < num(i) Then
max = num(i)
End If
Next i
Label1.Caption = "최댓값은 " & max & " 이다"
End Sub