Question: Could you please write the program in C Create a directory called labll on your machine using mkdir lab11 . Name this progratn Fib.cThis progtam

Could you please write the program in C
 Could you please write the program in C Create a directory

Create a directory called labll on your machine using mkdir lab11 . Name this progratn Fib.cThis progtam luoks at Fibonacci numbers (a classic recursive problem in CS) and the effort required to calculate them recursively. The recurrence relation for Fibonacci numbers is shown below Fib(n) Fib(n- 1) Fib(n 2) Complere the program showa below to calculate Fibonacci numbers and the number12 of function calls required to compute a given Fibonacci number. The program uses a global variable (count) to count the number of times the function fib is called. While global variables ate considered bad arc uscful in this situation 1219 #1 nolude long fib(long val) f 576515 count count+1 / recursive solution for Fibonacci goes hera int nain (int argc, char argv) long num atoi (argv[1]) long answer fib (num) printf ("fib (82d) -%ld ", nun , printf ("\tIt took ld recur8ive return 0 25 12139 242785 24 194418 2835 27 317 11 35521 2 51422 1028457 29 320401664079 answer); calls ", a unt); Nore that we use long instead of int so that we have extra prccision maximum value for an int is 2,147,483,647. The maximum value for a long is 9,233,372,036,854,775,807 with our values. Recall that the Try your program for a large Fibonacci number (such as 50 or 60 or 70) and note the execution time. A list of Fibonacci numbers can be found at ht lanetmath orp/listoffibonaccinumbers

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