Program zad;
uses crt;
type massiv=array[1..100] of real;
var
c:massiv;
i,j,n,a,b:integer;
kol:integer;
max,s:real;
procedure sort(var mas:massiv;kol:integer );
var i,k:integer;
t:boolean;
buf:real;
begin
repeat;
t:=true;
for i:=1 to kol-1 do
if abs(mas[i])<=abs(mas[i+1]) then
begin
buf:=mas[i];
mas[i]:=mas[i+1];
mas[i+1]:=buf;
t:=false;
end;
until t;
for k:=1 to kol do writeln(mas[k]:3:1,' ');
end;
begin
clrscr;
randomize;
write('введите n= ');readln(n);
writeln('введите диапазон от A до B ->');
write(' от ');
readln(a);
write(' до ');
readln(b);
kol:=0;
c[1]:=max;
j:=0;
for i:=1 to n do
begin
c[i]:=random(201)-100;
write(c[i]:3:1,' ');
if (c[i]<=b) and (c[i]>=a) then
kol:=kol+1 else
if c[i]>=max then
begin
max:=c[i];j:=i;
end;
end;
writeln;
s:=0;
for i:=j to n do begin
s:=s+c[i+1];
end;
write('колличество элементов в диапазоне [',a,',',b,'] = ',kol);
writeln;
writeln('сумма элементов после максимального = ',s:5:2);
writeln;
writeln(' отсортированный массив по модулю ');
textcolor(10);
sort(c,n);
readln;
end.