Page 1 of 1

12.10 LAB: Fibonacci sequence (recursion) The Fibonacci sequence begins with 0 and then 1 follows. All subsequent values

Posted: Sun Jul 10, 2022 11:26 am
by answerhappygod
12 10 Lab Fibonacci Sequence Recursion The Fibonacci Sequence Begins With 0 And Then 1 Follows All Subsequent Values 1
12 10 Lab Fibonacci Sequence Recursion The Fibonacci Sequence Begins With 0 And Then 1 Follows All Subsequent Values 1 (58.86 KiB) Viewed 438 times
12.10 LAB: Fibonacci sequence (recursion) The Fibonacci sequence begins with 0 and then 1 follows. All subsequent values are the sum of the previous two, for example: 0, 1, 1, 2, 3, 5, 8, 13. Complete the Fibonacci() function, which takes in an index, n, and returns the nth value in the sequence. Any negative index values should return -1. Ex: If the input is: 7 the output is: Fibonacci (7) is 13 Note: Use recursion and DO NOT use any loops. 395562.2030376.qx3zqy7 LAB ACTIVITY 12.10.1: LAB: Fibonacci sequence (recursion) 1 #include <iostream> 2 using namespace std; 3 4 int Fibonacci(int n){ 5 // type code here 6} 7 8 int main() { 9 10 11 12 13 14 15 } 16 int startNum; main.cpp cin >>startNum; cout << "Fibonacci(" << startNum << ") is " << fibonacci (startNum) << endl; return 0; 0/10 Load default template...