Question: The Fibonacci Sequence is defined to be F 0 = 0 ; F 1 = 1 ; Fn = Fn - 1 + Fn -

The Fibonacci Sequence is defined to be F0=0; F1=1; Fn = Fn-1+ Fn-2What this is saying is the first number in this sequence F0 is equal to 0, the second number in this sequence F1 is equal to 1, the third number in this sequence F2 is equal to F1+ F0 which is 1+0=1 and this continues for each number in the sequence n.Create a program that takes in an integer n and outputs the nth Fibonacci number using a recursive function. The output will have the following format.std::cout << "The "<< n <<"th Fibonacci number is: "<< fib_num << std::endl;We can reason about how to do this by thinking of the F as the function we are calling and the number n as the input to that input. What should the function do and return when n =0? n =1? n =3? n = n?Testing values./exercise_119

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 Programming Questions!