FIBOSUM Wrong Output

above is the link of my code , can anyone check what is wrong , i am trying to save this code on coding blocks ide , but its not working . please can anyone help

hi @mehul.narendra.dubey, your function for computing fibonacci number is wrong , you can check by passing different values to it ,so correct that, also the formula you are using should be
compute(m+2)-compute(n+1) (ref this for explanation :- https://www.quora.com/How-do-I-solve-the-FIBOSUM-Problem-on-SPOJ)

for reference , check this code (same concept as yours) :-

1 Like