Program Pr1; uses crt; var mas:array[1..15] of integer; i,max,min,b,v:integer; Begin clrscr; for i:=1 to 15 do mas[i]:=random(10); for i:=1 to 15 do write(mas[i]); max:=0; min:=100000; b:=0; for i:=1 to 15 do begin if mas[i]>max then max:=i; if mas[i]<min then min:=i; end; if max>min then for i:=min to max div 2 do begin v:=mas[max-b]; mas[max-b]:=mas[i]; mas[i]:=v; b:=b+1; end else for i:=max to min div 2 do begin v:=mas[min-b]; mas[min-b]:=mas[i]; mas[i]:=v; b:=b+1; end; writeln(); for i:=1 to 15 do write(mas[i]); end.
Program Pr1;
uses crt;
var mas:array[1..15] of integer;
i,max,min,b,v:integer;
Begin
clrscr;
for i:=1 to 15 do mas[i]:=random(10);
for i:=1 to 15 do write(mas[i]);
max:=0;
min:=100000;
b:=0;
for i:=1 to 15 do begin
if mas[i]>max then max:=i;
if mas[i]<min then min:=i;
end;
if max>min then for i:=min to max div 2 do begin
v:=mas[max-b];
mas[max-b]:=mas[i];
mas[i]:=v;
b:=b+1;
end
else for i:=max to min div 2 do begin
v:=mas[min-b];
mas[min-b]:=mas[i];
mas[i]:=v;
b:=b+1;
end;
writeln();
for i:=1 to 15 do write(mas[i]);
end.