PROGRAM WhileExample(Input, Output);
    { Program 4.2 - Compute the Nth partial sum of the
        harmonic series H(N) = 1 + 1/2 + 1/3 + ... + 1/N
        using a while statement. }
    VAR
        N: Integer;
        H: Real;

BEGIN
    Read(Input, N);
    Write(Output, N);

    H := 0;
    WHILE N > 0 DO
    BEGIN
        H := H + 1/N;
        N := N - 1;
    END;
    WriteLn(Output, H : 10: 3)
END.
