Const n=5;m=7; var a:array[1..n,1..m]of integer; b:array[1..n*m]of integer; i,j,buf,k:integer; begin for i:=1 to n do begin for j:=1 to m do begin a[i,j]:=random(100); write(a[i,j]:4); k:=k+1; b[k]:=a[i,j]; end; writeln; end; writeln; for i:=1 to n*m-1 do for j:=i+1 to n*m do if b[i]>b[j] then begin buf:=b[i]; b[i]:=b[j]; b[j]:=buf; end; for i:=1 to m*n do write(b[i]:4); end.
n=5;m=7;
var
a:array[1..n,1..m]of integer;
b:array[1..n*m]of integer;
i,j,buf,k:integer;
begin
for i:=1 to n do
begin
for j:=1 to m do
begin
a[i,j]:=random(100);
write(a[i,j]:4);
k:=k+1;
b[k]:=a[i,j];
end;
writeln;
end;
writeln;
for i:=1 to n*m-1 do
for j:=i+1 to n*m do
if b[i]>b[j] then
begin
buf:=b[i];
b[i]:=b[j];
b[j]:=buf;
end;
for i:=1 to m*n do
write(b[i]:4);
end.