Skip to content
← Back to Community
6.F. While: Fibonacci numbers
Profile icon
pole55

Fibonacci numbers are the numbers in the integer sequence starting with 1, 1 where every number after the first two is the sum of the two preceding ones:

1, 1, 2, 3, 5, 8, 13, 21, 34, ...

Given a positive integer n, print the nth Fibonacci number.

Example input
6

Example output
8

Voters
Profile icon
AddisonLeonard
Profile icon
S4C21
Profile icon
FINNFREIENSTEIN
Profile icon
zc29
Profile icon
DampAdam
Profile icon
KarineArakelyan
Profile icon
fusefame
Profile icon
tomsfy
Profile icon
pole55
Comments
hotnewtop
Profile icon
1SantiagO7

What does it mean "lst.append"?!
pleasee