Question: I need help on a C++ problem. Here is the problem: A Fibonacci number is always equal to the sum of the previous two Fibonacci

I need help on a C++ problem. Here is the problem:

A Fibonacci number is always equal to the sum of the previous two Fibonacci numbers (given that the first two Fibonacci numbers are 0 and 1). Try it out on the list above, and see if it works. These numbers are found everywhere in nature. A Fibonacci sequence is defined as follows: Fn = Fn-1 + Fn-2 In other words, if n=3, then F3 will be given by F2 + F1 or 1 + 1 = 2. F4 will be given by F3 + F2 or 1 + 2 = 3. And so forth. Create a function called, nextFibo(int, int) , which will contain two arguments, Fn-1 and Fn-2. The function will generate the next Fibonacci number in the sequence based on the two previous Fibonacci numbers given as arguments. The first two numbers in the sequence are: F0 = 0 and F1 = 1. Hint: If you make the arguments in nextFibo() reference parameter variables, then youll shorten your program a bit.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!