Program al; var a: array[1..32000] of integer; buf:integer; i,n,min,max:integer;begin writeln('n='); readln(n); writeln('vvedite massiv='); for i := 1 to n do readln(a[i]); min:=1; max:=1; for i:=2 to n do begin if a[min]>a[i] then min:=i; if a[max]<a[i] then max:=i; end; buf:=a[min]; a[min]:=a[max]; a[max]:=buf; writeln('Massiv posle obmena max<->min'); for i:=1 to n do write(a[i]:4); writeln; end.
var
a: array[1..32000] of integer;
buf:integer;
i,n,min,max:integer;begin
writeln('n=');
readln(n);
writeln('vvedite massiv=');
for i := 1 to n do
readln(a[i]);
min:=1;
max:=1;
for i:=2 to n do
begin
if a[min]>a[i] then
min:=i;
if a[max]<a[i] then
max:=i;
end;
buf:=a[min];
a[min]:=a[max];
a[max]:=buf;
writeln('Massiv posle obmena max<->min');
for i:=1 to n do
write(a[i]:4);
writeln;
end.