program Project63;

{\$APPTYPE CONSOLE}

uses
SysUtils;

const nmax=10;
type Tmatr= array [1..nmax,1..nmax] of real;
procedure diag(var ymatr:Tmatr;n:integer); //процедура нах наиб эл и меняет мест с диаг.
var
i,j,jmax:integer;
max:real;
begin
for i:=1 to n do
begin
max:=ymatr[i,1];
jmax:=1;
for j:= 1 to n do
if ymatr[i,j]>max then
begin
max:=ymatr[i,j];
jmax:=j
end;
ymatr[i,jmax]:=ymatr[i,i];
ymatr[i,i]:=max;
end;
end;
procedure sort(var ymatr:Tmatr;n:integer); //процедура сорт (методом пуз)
var i,j:integer;
a:real;
begin
for j:= 1 to n do
for i:=1 to (n-1) do
if ymatr[i,i]>ymatr[i+1,i+1] then
begin
a:=ymatr[i,i];
ymatr[i,i]:=ymatr[i+1,i+1];
ymatr[i+1,i+1]:=a;
end;
end;
var Bmatr:Tmatr;
n,i,j:integer;
begin
writeln('VV srok i stolb n');
writeln;
writeln('VV matr B');
writeln;
for i:=1 to n do
begin
for j:=1 to n do
end;
writeln('matr B');
for i:=1 to n do
begin
for j:=1 to n do
write(bmatr[i,j]:6:2,' ':3);
writeln;
end;
writeln;
diag(bmatr,n);
writeln('matr B perest');
for i:=1 to n do
begin
for j:=1 to n do
write(bmatr[i,j]:6:2,' ':3);
writeln;
end;
sort(bmatr,n);
writeln;
writeln('matr B otsortirovana9 diagonal');
for i:=1 to n do
begin
for j:=1 to n do
write(bmatr[i,j]:6:2,' ':3);
writeln;
end;