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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started