Fibonacci
started by: JGatJGat
on: 1212660602|%e %b %Y, %H:%M %Z|agohover
number of posts: 1
rss icon RSS: new posts
summary:
ProgComp 2008 Trial Question
Fibonacci
JGatJGat 1212660602|%e %b %Y, %H:%M %Z|agohover

The Fibonacci sequence is well known in mathematics. The first two values are 1 and 1, and every other value is the sum of the two previous values. The first dozen Fibonacci numbers are thus

1 1 2 3 5 8 13 21 34 55 89 144…

Write a program that displays the largest Fibonacci number less than or equal to a limit supplied to the program on each test run. For example, if the limit is 50, the program should just show 34.

Constraints - you may assume the limit is less than one million.

Run your program on the following three test cases:

Test Input
8
234
876543

last edited on 1213605981|%e %b %Y, %H:%M %Z|agohover by JGat + show more
unfold Fibonacci by JGatJGat, 1212660602|%e %b %Y, %H:%M %Z|agohover
new post
Unless stated otherwise Content of this page is licensed under Creative Commons Attribution-NonCommercial 3.0 License