Тут все
const
handsfree = true;
var
a: array[1..100] of real;
i, n: integer;
min, max: real;
sum, product, harmonic: real;
k: 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();
{подсчет элементов}
k := 0;
for i := 1 to n do
if a[i] > 5 then k := k + 1;
writeln(k);
{минимум и максимум}
max := a[1];
min := a[1];
for i := 1 to n do
begin
if max < a[i] then max := a[i];
if min > a[i] then min := a[i];
end;
writeln('max = ', max);
writeln('min = ', min);
{подсчет суммы и произведения и агригатов}
sum := 0;
product := 1;
harmonic := 1;
k := 0;
for i := 1 to n do
begin
if true then {если нужен фильтр}
begin
sum := sum + a[i];
product := product * a[i];
harmonic := harmonic + 1 / a[i];
k := k + 1;
end;
end;
writeln('sum = ', sum);
writeln('product = ', product);
writeln('average = ', sum / n);
writeln('average (selected) = ', sum / k);
writeln('harmonic mean = ', n / harmonic);
writeln('harmonic mean (selected) = ', k / harmonic);
{изменение элементов}
for i := 1 to n do
begin
if a[i] < 0 then
a[i] := abs(a[i]);
write(a[i], ' ');
end;
end.