Solution to C++ code: Make a recursive function which displays the fibonacci series before a number that … - Sikademy
Author Image

Archangel Macsika

C++ code: Make a recursive function which displays the fibonacci series before a number that is entered by the user. Requirements: No global declarations Test run in main Diagram: Also draw diagram to show how the recursive call is working

The Answer to the Question
is below this banner.

Can't find a solution anywhere?

NEED A FAST ANSWER TO ANY QUESTION OR ASSIGNMENT?

Get the Answers Now!

You will get a detailed answer to your question or assignment in the shortest time possible.

Here's the Solution to this Question


using namespace std; int FibonacciSeries(int n)  {    if((n==1)||(n==0)) return(n);    else return(FibonacciSeries(n-1)+FibonacciSeries(n-2)); } int main()  {    int num , i=0;    cout << "Enter a number (>=0): "; cin >> num;    cout << "\nThe Fibonnaci Series : ";    while(FibonacciSeries(i) <= num)     {       cout << " " << FibonacciSeries(i);       i++;    }    return 0; }

Related Answers

Was this answer helpful?

Join our Community to stay in the know

Get updates for similar and other helpful Answers

Question ID: mtid-3-stid-44-sqid-1028-qpid-24