uses Crt; const n=15; type Vec=array [1..n] of integer ; var i, SumOtr, ColOtr: integer; A: Vec ; begin ClrScr; Randomize; SumOtr:=0; ColOtr:=0; WriteLn (' Massiv A: '); for i:=1 to n do begin A[i]:=-10+random(20); if A[i]<0 then begin SumOtr:=SumOtr+A[i]; ColOtr:=ColOtr+1; end; Write (A[i]:4); end; WriteLn; WriteLn('ColOtr = ', ColOtr); WriteLn('SumOtr = ', SumOtr); WriteLn('SredOtr = ', SumOtr/ColOtr:4:2); ReadLn; end.
uses Crt;
const n=15;
type Vec=array [1..n] of integer ;
var i, SumOtr, ColOtr: integer;
A: Vec ;
begin
ClrScr;
Randomize;
SumOtr:=0;
ColOtr:=0;
WriteLn (' Massiv A: ');
for i:=1 to n do
begin
A[i]:=-10+random(20);
if A[i]<0 then
begin
SumOtr:=SumOtr+A[i];
ColOtr:=ColOtr+1;
end;
Write (A[i]:4);
end;
WriteLn;
WriteLn('ColOtr = ', ColOtr);
WriteLn('SumOtr = ', SumOtr);
WriteLn('SredOtr = ', SumOtr/ColOtr:4:2);
ReadLn;
end.