Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.math.BigInteger;
- /*
- ===========================================================================
- Author : Catarina Moreira
- Copyright : Catarina Moreira all rights reserved
- Description : Implementation of the fibonacci sequence using recursion
- ===========================================================================
- */
- public class Recursive
- {
- public BigInteger runFibonacci( int n )
- {
- if( n == 0)
- return BigInteger.ZERO;
- if( n == 1)
- return BigInteger.ONE;
- return runFibonacci( n - 1 ).add(runFibonacci( n - 2 ));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement