214k views
2 votes
Fill in the code to complete the following function for computing a Fibonacci number. public static int fib(int index) index == 1) // Base case ________ else // Reduction and recursive calls return fib(index - 1) + fib(index - 2).

A. fib(index - 1).
B. fib(index - 2).
C. fib(index - 1) + fib(index - 2)
D. fib(index - 2) + fib(index - 1).

User Mislav
by
7.3k points

1 Answer

3 votes

Answer:

B

Step-by-step explanation:

its easy just type that in

User Chickie
by
6.5k points