for i := 1 to n do for j := 1 to n do begin sum := 0; for k := 1 to n do sum := sum + a[i,k] * b[k,j]; c[i,j] := sum; end;