Const n=10; var a:array[1..n]of integer; i,buf,i_max,i_min:integer; begin for i:=1 to n do begin a[i]:=random(100); write(a[i]:4); end; i_max:=1;i_min:=1; for i:=1 to n do begin if a[i]<a[i_min] then i_min:=i; if a[i]>a[i_max] then i_max:=i; end; buf:=a[i_min]; a[i_min]:=a[i_max]; a[i_max]:=buf; for i:=1 to n do write(a[i]:4); end.
n=10;
var
a:array[1..n]of integer;
i,buf,i_max,i_min:integer;
begin
for i:=1 to n do
begin
a[i]:=random(100);
write(a[i]:4);
end;
i_max:=1;i_min:=1;
for i:=1 to n do
begin
if a[i]<a[i_min] then
i_min:=i;
if a[i]>a[i_max] then
i_max:=i;
end;
buf:=a[i_min];
a[i_min]:=a[i_max];
a[i_max]:=buf;
for i:=1 to n do
write(a[i]:4);
end.