Dim a() As Integer, b() As Integer, c() As Integer
Private Sub Command1_Click()
Dim i As Integer, j As Integer, a3 As String
ReDim c(1 To Val(Text1), 1 To Val(Text1))
For i = 1 To Val(Text1)
For j = 1 To Val(Text1)
c(i, j) = a(i, j) + b(i, j)
a3 = a3 & c(i, j) & " "
Next
a3 = a3 & vbCrLf
Next
Text4 = a3
End Sub
Private Sub Form_Load()
Randomize Timer
Text1 = 4
Text4 = ""
End Sub
Private Sub Text1_Change()
Text2 = "": Text3 = ""
Dim a1 As String, a2 As String, i As Integer, j As Integer
ReDim a(1 To Val(Text1), 1 To Val(Text1))
ReDim b(1 To Val(Text1), 1 To Val(Text1))
ReDim c(1 To Val(Text1), 1 To Val(Text1))
For i = 1 To Val(Text1)
For j = 1 To Val(Text1)
a(i, j) = Int(Rnd * 100)
a1 = a1 & a(i, j) & " "
b(i, j) = Int(Rnd * 100)
a2 = a2 & b(i, j) & " "
Next
a1 = a1 & vbCrLf
a2 = a2 & vbCrLf
Next
Text2 = a1: Text3 = a2
End Sub