Generate a c program for fibonacci function using


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

Solution Preview :

Prepared by a verified Expert
Business Management: Generate a c program for fibonacci function using
Reference No:- TGS02920982

Now Priced at $10 (50% Discount)

Recommended (90%)

Rated (4.3/5)