var i, sum, num : integer;
var D: array [0..10] of integer;
begin
sum := 0;
for i:= 0 to 10 do begin
readln(num);
D[i] := num;
end;
for i := 0 to 10 do begin
if D[i] >= 0 then
sum := sum + D[i];
writeln('Результат = ' + sum);
end.
Объяснение:
var i, sum, num : integer;
var D: array [0..10] of integer;
begin
sum := 0;
for i:= 0 to 10 do begin
readln(num);
D[i] := num;
end;
for i := 0 to 10 do begin
if D[i] >= 0 then
sum := sum + D[i];
end;
writeln('Результат = ' + sum);
end.
Объяснение: