Fibonacci
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