Private Sub Command1_Click()
Dim A(4, 4) As Integer
Dim i As Integer
Dim j As Integer
Randomize
For i = 0 To 4
For j = 0 To 4
A(i, j) = Int(Rnd * (90 - 40) + 40)
Next j
Next i
For i = 0 To 4
For j = 0 To 4
Me.Text1.Text = Me.Text1.Text & A(i, j) & " "
If j = 4 Then
Me.Text1.Text = Me.Text1.Text & vbCrLf
End If
Next j
Next i
Dim max As Integer
Dim maxI As Integer
Dim maxJ As Integer
max = A(0, 0)
maxI = 0
maxJ = 0
For i = 0 To 4
For j = 0 To 4
If A(i, j) > max Then
max = A(i, j)
maxI = i
maxJ = j
End If
Next j
Next i
Me.Label1.Caption = max
Me.Label2.Caption = maxI
Me.Label3.Caption = maxJ
End Sub
Dim A(4, 4) As Integer
Dim i As Integer
Dim j As Integer
Randomize
For i = 0 To 4
For j = 0 To 4
A(i, j) = Int(Rnd * (90 - 40) + 40)
Next j
Next i
For i = 0 To 4
For j = 0 To 4
Me.Text1.Text = Me.Text1.Text & A(i, j) & " "
If j = 4 Then
Me.Text1.Text = Me.Text1.Text & vbCrLf
End If
Next j
Next i
Dim max As Integer
Dim maxI As Integer
Dim maxJ As Integer
max = A(0, 0)
maxI = 0
maxJ = 0
For i = 0 To 4
For j = 0 To 4
If A(i, j) > max Then
max = A(i, j)
maxI = i
maxJ = j
End If
Next j
Next i
Me.Label1.Caption = max
Me.Label2.Caption = maxI
Me.Label3.Caption = maxJ
End Sub