Question: Write a function that takes as an input a number ' n ' and returns a vector containing n numbers of the Fibonacci sequence. Assume

Write a function that takes as an input a number 'n' and returns a vector containing n numbers of the Fibonacci sequence. Assume that the input n is an integer equal to or greater than 2. Run the function for inputs: 2,7 and 9.
Recall: The Fibonacci sequence follows the trend
ni=ni-1+ni-2
Hint: Use if statements to generate the vector if the sequence is 1 or 2 numbers long.
 Write a function that takes as an input a number 'n'

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!