Паскаль.
var
N, x, i, sum : integer;
begin
readln(N);
sum := 0;
for i:=1 to N do begin
readln(x);
if x<0 then sum := sum + x;
end;
writeln(sum);
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Паскаль.
var
N, x, i, sum : integer;
begin
readln(N);
sum := 0;
for i:=1 to N do begin
readln(x);
if x<0 then sum := sum + x;
end;
writeln(sum);
end.