+ 1

Retur fib(x-1)+fib(x-2),x(4)

(4-1)+(4-2) 3+2 5 So 5 is the correct answer

1st Apr 2020, 10:35 AM
Nidhi Agrawal
Nidhi Agrawal - avatar
2 Answers
+ 1
Thank you....
1st Apr 2020, 10:57 AM
Nidhi Agrawal
Nidhi Agrawal - avatar
0
fib(4-1) + fib(4-2) = fib(3) + fib(2) 👇 👇 =fib(3-1)+fib(3-2) + fib(2-1)+fib(2-2) = fib(2)+ fib(1)+fib(1)+fib(0) 👇 =fib(2-1)+fib(2-2) + 1+1+1 =fib(1)+fib(0) + 3 =1+1+3 =5 Hoping that, If there is statement: if(x==0 || x==1) return 1; Otherwise it is Infinite...
1st Apr 2020, 10:53 AM
Jayakrishna 🇼🇳