Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #This algorithm was crated by Lucas Pereira Torres de Araujo
- #Lista 3 - FUP's Class - 2016.1
- #Item 1.28
- print ">>> H = 1 + 1/2 + 1/3 + 1/4+ ... + 1/N <<<\n"
- n = input("Digite o valor de N: ")
- x = 0
- i = 0
- if n == 0:
- print ">>> Nao eh possivel realizar esse calculo."
- while n >= 1:
- i += float(1)
- x += float(1/i)
- n -= 1
- print "H =", x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement