var a: array[1..100] of real; i, n: integer; sum, product, harmonic: real;
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 := 0; for i := 1 to n do if abs(a[i]) <= 5 then sum := sum + a[i]; writeln('sum = ', sum); end.
Answers & Comments
Verified answer
Consthandsfree = false;
var
a: array[1..100] of real;
i, n: integer;
sum, product, harmonic: real;
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 := 0;
for i := 1 to n do
if abs(a[i]) <= 5 then
sum := sum + a[i];
writeln('sum = ', sum);
end.