const n=8;
var i,j,v,max,k:integer;
a:array [1..n] of integer = (0,1,9,2,4,3,6,5);
begin
write (' Исходный массив: ');
for i:=1 to n do write(a[i],' ');
writeln;
for i:=1 to n-1 do
begin
max:=i;
for j:=i+1 to n do
if a[j] > a[max] then max:=j;
v:=a[i];
a[i]:=a[max];
a[max]:=v
end;
write ('Преобразованный массив: ');
for i:=1 to n do write(a[i],' ');
end.