Skip to content

Instantly share code, notes, and snippets.



Created Jul 15, 2016
What would you like to do?
fibonacci tail recursion
int fib(int term, int val = 1, int prev = 0)
if(term == 0) return prev;
if(term == 1) return val;
return fib(term - 1, val+prev, val);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment