Program pr; var a:array [1..10] of integer i, imax, imin, mx, mn, n:integer; begin for i := 1 to 10 do a[i] := random(50); mx := a[1]; for i := 2 to 10 do begin if a[i] > mx then begin mx := a[i]; imax := i end; end; mn := a[0]; for i := 2 to 10 do begin if a[i] < mn then begin mn := a[i]; imin := i end; end; a[imax] := mn; a[imin] := mx writeln(a); end.
var a:array [1..10] of integer
i, imax, imin, mx, mn, n:integer;
begin
for i := 1 to 10 do
a[i] := random(50);
mx := a[1];
for i := 2 to 10 do
begin
if a[i] > mx then
begin
mx := a[i];
imax := i
end;
end;
mn := a[0];
for i := 2 to 10 do
begin
if a[i] < mn then
begin
mn := a[i];
imin := i
end;
end;
a[imax] := mn;
a[imin] := mx
writeln(a);
end.