Const n=4; var arr: array[1..n, 1..n] of integer; i, j, t, buf: integer; begin for i:=1 to n do for j:=1 to n do begin write('Введите элемент: '); readln(arr[i,j]); end; writeln('Введеная матрица:'); for i:=1 to n do begin for j:=1 to n do write(arr[i,j]:4); writeln(); end; //Сортировка for j:=1 to n do for i:=1 to n-1 do for t:=i+1 to n do if arr[i,j] > arr[t,j] then begin buf := arr[i,j]; arr[i,j] := arr[t,j]; arr[t,j] := buf; end; writeln('Отсортированная матрица:'); for i:=1 to n do begin for j:=1 to n do write(arr[i,j]:4); writeln(); end; end.
n=4;
var
arr: array[1..n, 1..n] of integer;
i, j, t, buf: integer;
begin
for i:=1 to n do
for j:=1 to n do
begin
write('Введите элемент: ');
readln(arr[i,j]);
end;
writeln('Введеная матрица:');
for i:=1 to n do
begin
for j:=1 to n do
write(arr[i,j]:4);
writeln();
end;
//Сортировка
for j:=1 to n do
for i:=1 to n-1 do
for t:=i+1 to n do
if arr[i,j] > arr[t,j] then
begin
buf := arr[i,j];
arr[i,j] := arr[t,j];
arr[t,j] := buf;
end;
writeln('Отсортированная матрица:');
for i:=1 to n do
begin
for j:=1 to n do
write(arr[i,j]:4);
writeln();
end;
end.