Var
a: array [1..15] of integer;
avg, avgpol, avgotr: real;
i, k1, k2: byte;
begin
avg := 0; avgpol := 0; avgotr := 0;
writeln('Massiv:');
Randomize;
for i:=1 to 15 do
begin
a[i]:=random(20)-10;
write(a[i], ' ');
avg:=avg + a[i];
if a[i] > 0 then
begin
avgpol := avgpol + a[i];
inc(k1);
end;
if a[i] < 0 then
begin
avgotr := avgotr + a[i];
inc(k2);
end;
end;
avg:=avg/15;
avgpol:= avgpol/k1;
avgotr:= avgotr/k2;
writeln;
writeln('Srednee massiva = ', avg:3:2);
writeln('Srednee polozh. elementov = ', avgpol:3:2);
writeln('Srednee otric. elementov = ', avgotr:3:2);
readln;
end.