procedure TForm1.Button1Click(Sender: TObject);
const r1 =3;
r2=3;
c1=1;
c2=3;
var mat1 : ARRAY [1..3, 1..3] OF INTEGER;
mat2 : ARRAY [1..3, 1..3] OF INTEGER;
result : ARRAY [1..3, 1..3] OF INTEGER;
// r2 has to be equal to c1 !
// r1 has to be equal to c2 !
// will work for r,c > 3 too;
var r,c,i : integer;
begin
for r := 1 to r1 do
for c := 1 to c2 do
begin
result[r,c] := 0;
for i := 1 to c1 do
result[r,c] := result[r,c] + mat1[r,i]*mat1[i,c];
end;
end;