mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-28 08:30:34 +08:00
57623d42eb
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5153 42af7a65-404d-4744-a932-0658087f49c3
17 lines
228 B
ObjectPascal
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.
|