Цитата:
Сообщение от billchester
помогите пожалуйста.............
|
Ладно, чего-то я сегодня добрый:
Код:
CONST
N=10;
VAR
m:ARRAY[1..N] of Real;
i,j,Imax,Num:byte;
d,A,B,Max,S:Real;
BEGIN
Randomize;
Max:=-100;
Num:=0;
S:=0;
For i:=1 to N do
begin
m[i]:=20*Random-10;
Write(m[i]:8:3);
If m[i]>Max then
begin
Max:=m[i];
Imax:=i;
end;
end;
writeln;
Write('A= ');
ReadLn(A);
Write('B= ');
ReadLn(B);
For i:=1 to N do
If (m[i]>A) and (m[i]<B) then Inc(Num);
WriteLn('Number of elements between A and B is ',Num);
WriteLn('Maximum is the element number ',Imax,' equal to ',m[Imax]:8:3);
For i:=Imax+1 to N do
S:=S+m[i];
WriteLn('Sum of elements from ',Imax+1, ' to ',N,' is ',S:10:3);
For i:=1 to N-1 do
For j:=1 to N-i do
If ABS(m[j])<ABS(m[j+1]) then
begin
d:=m[j];
m[j]:=m[j+1];
m[j+1]:=d;
end;
For i:=1 to N do
Write(m[i]:8:3);
readln;
END.