Files
PX4-Autopilot/misc/pascal/tests/src/003-for.pas
T
2011-12-19 19:24:09 +00:00

17 lines
228 B
ObjectPascal

{ compute h(n) = 1 + 1/2 + 1/3 +...+ 1/n }
program egfor(input, output);
var
i, n : integer;
h : real;
begin
read(n);
writeln(n);
h := 0;
for i:= n downto 1 do
h := h + 1/i;
writeln(h);
end.