Answered You can hire a professional tutor to get the answer.

QUESTION

Generate a C++ program for Fibonacci function using Stack Fibonacci function Fib(n) is given below.

Generate a C++ program for Fibonacci function using Stack

Fibonacci function Fib(n) is given below.

Fib(n)= Fib(n-1) + Fib(n-2) for n > 1

Fib(n)= 1 for n=1

Fib(n)= 0 for n=0

Using following initialization

unsigned int *Fib = new unsigned int[30];

and function prototypes

void push(int n, unsigned int * Fib)

unsigned int pop(unsigned int * Fib )

insert first 30 Fibonacci numbers into dynamic array Fib and then pop them to print out first 30 numbers in descending order.

The output of your program should be

514229, 317811, 196418, ......, 1, 1, 0

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question