Dim matrixA(,), matrixB(,), matrixP(,) As Integer Dim fillA, fillB As Integer Dim strA, strB, strP As String size = InputBox("Please Enter the size of the matrices") ReDim matrixA(Size, Size) ReDim matrixB(Size, Size) For i As Integer = 0 To (size - 1) For j As Integer = 0 To (size - 1) Randomize() fillA = Rnd() * 99 matrixA(i, j) = fillA strA = strA & matrixA(i, j) & " " Next j strA = strA & Environment.NewLine Next i lblA.Text = strA For m As Integer = 0 To (size - 1) For n As Integer = 0 To (size - 1) Randomize() fillB = Rnd() * 99 matrixB(m, n) = fillB strB = strB & matrixB(m, n) & " " Next strB = strB & Environment.NewLine Next lblB.Text = strB ReDim matrixP(size, size) For i As Integer = 0 To size - 1 For j As Integer = 0 To size - 1 matrixP(i, j) = matrixP(i, j) + (matrixA(i, j) * matrixB(i, j)) strP = strP & matrixP(i, j) & " " Next strP = strP & Environment.NewLine Next lblC.Text = strP