Ответ:
program ArraySum;
var
a: array of Integer;
n, i, s: Integer;
begin
Write ('Введите размерность массива: ');
ReadLn (n);
SetLength (a, n);
Randomize;
for i := Low (a) to High (a) do begin
a [i] := Random (61) - 30;
Write (a [i], ' ');
end;
s := 0;
if a [i] < 3 then
s := s + a [i];
WriteLn;
WriteLn ('Сумма чисел меньших 3 = ', s);
ReadLn;
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
Ответ:
program ArraySum;
var
a: array of Integer;
n, i, s: Integer;
begin
Write ('Введите размерность массива: ');
ReadLn (n);
SetLength (a, n);
Randomize;
for i := Low (a) to High (a) do begin
a [i] := Random (61) - 30;
Write (a [i], ' ');
end;
s := 0;
for i := Low (a) to High (a) do begin
if a [i] < 3 then
s := s + a [i];
end;
WriteLn;
WriteLn ('Сумма чисел меньших 3 = ', s);
ReadLn;
end.