Lời giải :
+) for-do
program hotrotinhoc ;
var i,tong : integer ;
begin
tong:=0;
for i:=1 to 30 do tong:=tong+i;
write('Tong la:,tong');
readln
end.
+) while-do
program hotrotinhoc ;
var n,tong : integer ;
begin
tong:=0; n:=0;
while n < 30 do
begin
n:=n+1;
tong:=tong+n;
end;
write('Tong la:',tong);
readln
end.