Develope a Fibonacci series of 20 numbers. Now push these elements into stack and then pop them.After pop each element should get inserted into queue and after dequeuing each element get inserted in link list and then print that linked list.
#include<bits/stdc++.h>
using namespace std;
int fibonacci(int n)
{
if (n <= 1)
return n;
return fibonacci(n-1) + fibonacci(n-2);
}
int main ()
{
int n = 9;
cout << fibonacci(n);
return 0;
}
Comments
Leave a comment