program whilefor;
var
s,i,n:integer;
begin
write(' nhap n : ');
readln(n);
s:=0;
for i:= 1 to n do
s:= s +i;
writeln(' tong khi dung vong lap for la : ',s);
s:=0;
i:=0;
while i<=n do
begin
i:=i+1;
s:=s+i;
end;
write(' tong khi dung vong lap while la : ',s);
readln;
end.
Program CT_Tinh_Tong;
Uses Crt;
Var n,i:integer;
S;longint;
Begin
CLRSCR;
Write ('n=');readln (n);
S:=0;
For i:=1 to n do S:=S+i;
Write ('S=',S);
Readln;
End.
var n,i,s:longint;
begin
write('n=');readln(n);
s:=0;
for i:=1 to n do s:=s+i;
write('Tong:',s);
readln;
end.