private int fib ( int value , int current , int previous ) { if ( value == 0 ) { return previous ; } else if ( value == 1 ) { return current ; } return fib ( value - 1 , current + previous , current ) ; }
Tail recursive implementation of fibonacci