Program HOC24;
var i,n: integer;
t: longint;
begin
read(n);
t:=n;
if n<>0 then
begin
while n<>0 do
begin
read(n);
t:=t+n;
end;
end;
readln;
readln
end.
Cách khác:
uses crt;
var n,t:integer;
begin
clrscr;
t:=0;
repeat
write('n='); readln(n);
t:=t+n;
until n=0;
writeln(t);
readln;
end.