1.
var n,s,i:integer;
begin
write('n='); readln(n);
s:=0;
for i:=1 to n do s:=s+i;
writeln('s=',s);
end.
2.
var n,s,i:integer;
begin
write('n='); readln(n);
s:=0; i:=0;
while i begin i:=i+1; s:=s+i; end;
writeln('s=',s);
end.
3.
var n,s,i:integer;
begin
write('n='); readln(n);
s:=0; i:=0;
repeat
i:=i+1; s:=s+i;
until i=n;
writeln('s=',s);
end.
Пример:
n=5
s=15