program dark_side;
uses crt;
type
ar = array [1 .. 100] of integer;
var
i, n, f, j, t, i_max: integer;
a: ar;
begin
clrscr;
randomize;
writeln('enter length');
readln(n);
writeln('1.Input by hand');
writeln('2.Autofill');
read(f);
if f = 1 then
for i := 1 to n do
begin
write('a[', i, ']=');
readln(a[i]);
end
else
for i := 1 to n do
a[i] := random(100);
for i := 1 to n do
write(a[i]:3);
writeln;
for i := 1 to n - 1 do
begin
i_max := i;
for j := i_max + 1 to n do
if a[j] > a[i_max] then
i_max := j;
t := a[i];
a[i] := a[i_max];
a[i_max] := t;
end;
readln;
for i := 1 to n do
write(a[i]:3);
readln;
end.