Nombres harmònics (1) P59539


Statement
 

pdf   zip

html

Feu un programa que llegeixi un nombre n i que escrigui el nombre harmònic n-èsim, definit com Hn = 1/1 + 1/2 + ⋯ + 1/n.

Entrada

L’entrada consisteix en un natural n.

Sortida

Cal escriure Hn amb quatre xifres decimals.

Public test cases
  • Input

    2
    

    Output

    1.5000
    
  • Input

    0
    

    Output

    0.0000
    
  • Input

    7
    

    Output

    2.5929
    
  • Information
    Author
    Salvador Roura
    Language
    Catalan
    Other languages
    English
    Official solutions
    C++ Java Python
    User solutions
    C C++ Java PHP Python Rust