program bai1;
var n,s,i,x:longint;
begin
write('N= ');
readln(n);
i:=1;s:=0;
while i<=n do
begin
write('x',i,'= ');
readln(x);
if x<0 then s:=s+x;
i:=i+1;
end;
write('S= ',s);
readln
end.
sửa lại ở chỗ while do là
begin
write('X= ');readln(x);
if x mod 2=0 then s:=s+x;
i:=i+1;
end;
program bai_tap;
type mang = array[1..1000] of integer;
var a:mang;
i,j,n:integer;
begin
writeln('nhap n:');
readln(n);
i:=1;j:=0;
while i <= n do
begin
write('nhap so thu ',i,': ');
readln(a[i]);
if a[i] mod 2 = 0 then j:=j+a[i];
inc(i);
end;
write(j);
readln
end.