program fantscrin;
const n = 20;
var a: array [1..n] of integer;
i,max,k:integer;
Begin
for i:=1 to n do
a[i]:= random(21)-10;
write(a[i], ' ');
max:=a[1];
k:=1;
writeln('');
for i:=2 to n do
if (a[i]> max) then
begin
max:=a[i];
k:=i;
end;
i:=a[1];
a[1]:=a[k];
a[k]:=i;
End.
program fantscrin;
const n = 20;
var a: array [1..n] of integer;
i,max,k:integer;
Begin
for i:=1 to n do
a[i]:= random(21)-10;
for i:=1 to n do
write(a[i], ' ');
max:=a[1];
k:=1;
writeln('');
for i:=2 to n do
if (a[i]> max) then
begin
max:=a[i];
k:=i;
end;
i:=a[1];
a[1]:=a[k];
a[k]:=i;
for i:=1 to n do
write(a[i], ' ');
End.