program tinhtongtubanphim;
var i,s : real; kt:boolean;
begin
s:=0;
kt:=true;
while kt=true do
begin
write("nhap so tu ban phim: ");
readln(i);
s:=s+i;
if i:=0 then kt:=false;
end;
writeln('Tong = ',s);
readln;
end.
Lời giải:
program hotrotinhoc;
var n: integer;
t: longint;
begin
write('Nhap so :'); readln(n);
t:=n;
while n<>0 do
Begin
write('Nhap so:'); readln(n);
t:=t+n;
end;
write(t);
readln
end.