fibonacci.mj 298 Bytes
Newer Older
tnstrssnr's avatar
tnstrssnr committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
class FibonacciRecursive {
    public static void main(String[] args) {
        int a = 10;
        int f = fibonacci(a);
    }

    public int fibonacci(int n) {
        if(n <= 1) {
            return n;
        } else {
            return fibonacci(n - 1) + fibonacci(n - 2);
        }
    }
}