Function getSumFor(n:integer):integer;var sum, i:integer;begin sum := 0; for i:=1 to n do begin sum := sum + i; end; result := sum;end;
function getSumWhile(n:integer):integer;var sum, i:integer;begin sum := 0; i := 1; while i <= n do begin sum := sum + i; i := i + 1; end; result := sum;end;<br>function getSumRepeat(n:integer):integer;var sum, i:integer;begin i := 1; sum := 0; repeat sum := sum + i; i := i + 1; until i > n; result := sum;end;
begin writeln(getSumFor(1)); writeln(getSumWhile(1)); writeln(getSumRepeat(1));end.