Uses crt; const N=30; var a:array [1..N] of integer; x,min,max,t:integer; begin for x:=1 to N do begin write('a[',x,']:'); readln(a[x]); end; min:=1; max:=1; for x:=1 to N do begin if a[x]<a[min] then min:=x; if a[x]>a[max] then max:=x; end; t:=a[max]; a[max]:=a[min]; a[min]:=t; for x:=1 to N do write(a[x]:4); end.
const N=30;
var a:array [1..N] of integer;
x,min,max,t:integer;
begin
for x:=1 to N do
begin
write('a[',x,']:');
readln(a[x]);
end;
min:=1; max:=1;
for x:=1 to N do
begin
if a[x]<a[min] then min:=x;
if a[x]>a[max] then max:=x;
end;
t:=a[max];
a[max]:=a[min];
a[min]:=t;
for x:=1 to N do
write(a[x]:4);
end.