Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > b9ba69a436161613d8fb030c8c726a8e > files > 521

spirit-1.5.1-2mdk.noarch.rpm

{ program 4.4
  compute h(n) = 1 + 1/2 + 1/3 +...+ 1/n }

program egfor(input, output);

var
  i, n : integer;
  h : real;

begin
  read(n);
  write(n);
  h := 0;
  for i:= n downto 1 do
    h := h + 1/i;
  writeln(h);
end.