Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. import time
  2. endwhile = "endwhile";
  3. endfor = "endfor";
  4. endif = "endif";
  5. n = 0
  6. while(n<3):
  7.     n = int(input("Digite o numero de termos da sequencia:"))
  8. endwhile
  9. j = 1
  10. SeqFibo = []
  11. SeqFibo.append(j)
  12. while(j <= n):
  13.     if((j==1) or (j==2)):
  14.         Termo = 1
  15.         SeqFibo.append(Termo)
  16.     else:
  17.         Termo = SeqFibo[j-1] + SeqFibo[j-2] #fórmula da sequência
  18.         SeqFibo.append(Termo)
  19.     endif
  20.     print(SeqFibo[j])
  21.     j = j + 1
  22. endwhile
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement