//PascalABC.Net v3.1
const n = 10;
var imin,imax,max,min,i:integer;
a:array[1..n] of integer;
begin
min := maxint;
max := - maxint;
for i:=1 to n do begin
a[i]:= random(-20,95);
if a[i]<= min <span>then begin
min:=a[i]; imin:=i;
end;
if a[i]>= max then begin
max:=a[i]; imax:=i;
end;
write(a[i]:4);
end;
writeln;
writeln(min:4,imin:4,max:4,imax:4);
(a[imin],a[imax]):=(a[imax],a[imin]);
for i:=1 to n do write(a[i]:4);
end.
Тестовое решение:
1 -6 43 28 13 -10 64 92 85 95
-10 6 95 10
1 -6 43 28 13 95 64 92 85 -10