const
n=5;
m=5;
var
a:array [1..n,1..m] of integer;
i,j,k,t:integer;
begin
writeln('Исходная матрица:');
for i:=1 to n do
for j:=1 to m do
a[i,j]:=random(8)-4;
write(a[i,j]:2,' ')
end;
writeln
for j:=1 to m-1 do
for k:=j+1 to m do
if a[i,j]>a[i,k] then
t:=a[i,j];
a[i,j]:=a[i,k];
a[i,k]:=t
writeln('Полученная матрица:');
write(a[i,j]:2,' ');
end.
const
n=5;
m=5;
var
a:array [1..n,1..m] of integer;
i,j,k,t:integer;
begin
writeln('Исходная матрица:');
for i:=1 to n do
begin
for j:=1 to m do
begin
a[i,j]:=random(8)-4;
write(a[i,j]:2,' ')
end;
writeln
end;
for i:=1 to n do
for j:=1 to m-1 do
for k:=j+1 to m do
if a[i,j]>a[i,k] then
begin
t:=a[i,j];
a[i,j]:=a[i,k];
a[i,k]:=t
end;
writeln('Полученная матрица:');
for i:=1 to n do
begin
for j:=1 to m do
write(a[i,j]:2,' ');
writeln
end;
end.