a)
uses crt;
var s,i,n:integer;
begin
clrscr;
write('nhap n='); readln(n);
s:=0;
for i:=1 to n do
s:=s+i;
writeln(s);
readln;
end.
b)
uses crt;
var s,i,n:integer;
begin
clrscr;
write('nhap n='); readln(n);
s:=0;
i:=1;
while i<=n do
begin
s:=s+i;
inc(i);
end;
writeln(s);
readln;
end.