Var
a:array[1..20] of integer;
i,max,c,nom:integer;
begin
max:=-100000000;
for i:=1 to 20 do begin
a[i]:=random(20)-10;
write(a[i],' ');
end;
for i:=1 to 20 do begin
if (a[i]<0) and (a[i]>max) then nom:=i;
if (a[i]<0) and (a[i]>max) then max:=a[i];
end;
writeln;
for i:=1 to 20 do begin
if i=nom then swap(a[nom],a[1]);
end;
for i:=1 to 20 do begin
write(a[i],' ');
end;
writeln('max=',max,');
end.