- #1
cgrumiea
- 4
- 0
Homework Statement
The first several numbers in the "Fibonacci Sequence" are 0, 1, 1, 2, 3, 5, 8, 13, 21, ... Each number is formed by summing the two previous numbers. Define a method named prevFib that takes a non-zero Fibonacci number and returns the Fibonacci number that comes immediately before it in the sequence.
prevFib(21) ==> 13
Hint: use a recursive helper method.
Homework Equations
The Attempt at a Solution
I'm brand new at java and hardly understand the recursion within it. I know scheme, but this is a different ball game. My main question is what I should do for the recursive helper. Or how that will help when finding the previous Fib number. Any help would be appreciated.