mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-07 11:20:35 +08:00
57623d42eb
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5153 42af7a65-404d-4744-a932-0658087f49c3
19 lines
244 B
ObjectPascal
19 lines
244 B
ObjectPascal
{ compute h(n) = 1 + 1/2 + 1/3 +...+ 1/n }
|
|
|
|
program egrepeat(input, output);
|
|
|
|
var
|
|
n : integer;
|
|
h : real;
|
|
|
|
begin
|
|
read(n);
|
|
writeln(n);
|
|
h := 0;
|
|
repeat
|
|
h := h + 1/n;
|
|
n := n - 1;
|
|
until n=0;
|
|
writeln(h);
|
|
end.
|