Var i,sum:integer; a:array [1..20] of integer; begin for i:=1 to 20 do begin a[i]:=Random(-50,50); end; writeln('Полученный массив: '); for i:=1 to 20 do begin write(' '); write(a[i]); end; writeln(); sum:=0; for i:=1 to 20 do begin if (a[i]>0) then sum:=sum+a[i]; end; writeln('Сумма = ',sum); end.
i,sum:integer;
a:array [1..20] of integer;
begin
for i:=1 to 20 do begin
a[i]:=Random(-50,50);
end;
writeln('Полученный массив: ');
for i:=1 to 20 do begin
write(' ');
write(a[i]);
end;
writeln();
sum:=0;
for i:=1 to 20 do begin
if (a[i]>0) then sum:=sum+a[i];
end;
writeln('Сумма = ',sum);
end.