const handsfree = false;var a: array[1..100] of real; i, n: integer; sum_pos, sum_neg: real; k_pos, k_neg: integer;begin {ввод массива} if handsfree then n := random(20) + 5 else begin write('n = '); readln(n); end; writeln('Данные массива:'); for i := 1 to n do begin if handsfree then begin a[i] := random(100) - 50; write(a[i], ' '); end else readln(a[i]); end; writeln(); {подсчет} sum_pos := 0; k_pos := 0; sum_neg := 0; k_neg := 0; for i := 1 to n do begin if a[i] > 0 then begin sum_pos := sum_pos + a[i]; k_pos := k_pos + 1; end; if a[i] < 0 then begin sum_neg := sum_neg + a[i]; k_neg := k_neg + 1; end; end; writeln('average (positives) = ', sum_pos / k_pos); writeln('average (negatives) = ', sum_neg / k_neg);end.