Var
a:array of array of integer;
n,m,i:integer;
begin
writeln('n, m:');
readln(n,m);
SetLength(a,n);
for i:=0 to n-1 do
SetLength(a[i],m);
for i:=0 to n*m-1 do
a[i div m,i mod m]:=(i div m)*(i mod m);
for i:=0 to n*m-1 do
begin
write(a[i div m,i mod m]:3);
if (i+1) mod m = 0 then writeln;
end;
end.
Пример:
n, m:
4 5
0 0 0 0 0
0 1 2 3 4
0 2 4 6 8
0 3 6 9 12