var a: array[1..8] of integer;
i,s: integer;
begin
randomize;
s:=0;
write('массив: ');
for i:=1 to 8 do begin
a[i]:=random(41)-20;
if a[i]<10 then s:=s+a[i];
write(a[i],' ');
end;
writeln;
write('сумма: ',s);
end.
PascalABC.NET
var a := ArrRandom(8, -20, 20);
a.Println;
a.Where(p -> p < 10).Sum.Println
var a: array[1..8] of integer;
i,s: integer;
begin
randomize;
s:=0;
write('массив: ');
for i:=1 to 8 do begin
a[i]:=random(41)-20;
if a[i]<10 then s:=s+a[i];
write(a[i],' ');
end;
writeln;
write('сумма: ',s);
end.
PascalABC.NET
begin
var a := ArrRandom(8, -20, 20);
a.Println;
a.Where(p -> p < 10).Sum.Println
end.