asked 205k views
5 votes
Fill in the code to complete the following function for computing a Fibonacci number. public static int fib(int index)

asked
User Twinsen
by
7.8k points

1 Answer

5 votes

Answer:

return 0;

Explanation:

The Fibonacci numbers such that each number is the sum of the two preceding ones, but the first therm of the sequence cannot be built by this rule.

In that
F_(0) = 0

Then you may define it in the base case

return 0;

answered
User Batuman
by
8.3k points
Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.