edited by
393 views

2 Answers

Best answer
7 votes
7 votes

Total number of times return statement get executed $=15.$

 

selected by
9 votes
9 votes

Number of times return statement getting executed is same as the number of calls to fib.

  • fib(5) = fib(4) + fib(3) + 1
  • fib(4) = fib(3) + fib(2) + 1
  • fib(3) = fib(2) + fib(1) + 1
  • fib(2) = fib(1) + fib(0) + 1
  • fib(1) = 1
  • fib(0) = 1

Now, going up we get,

  • fib(2) = 3
  • fib(3) = 5
  • fib(4) = 9
  • fib(5) = 15
edited by
Answer:

Related questions

8 votes
8 votes
2 answers
1
gatecse asked Jul 26, 2020
717 views
The number of characters (including whitespaces if any) printed by the following C program is#define sum(a, b) #a "+"#b "=%d" #include<stdio.h int main() { printf(sum(6,9...
6 votes
6 votes
1 answer
2
gatecse asked Jul 26, 2020
562 views
What will be the output of the following C program?(Assume IEEE -$754$ standard being Used)#include<stdio.h int main() { float a = 8.0625; if(a == 8.0625) { printf("1"); ...
4 votes
4 votes
1 answer
4
gatecse asked Jul 26, 2020
277 views
What will be the output of the following C program?#include<stdio.h int main() { int myinc = -1; if(++myinc || myinc) { myinc ; } printf("%d", myinc); }