fibonacci.mj 347 Bytes
Newer Older
uwwrp's avatar
uwwrp committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
class Fibonacci {
    public static void main(String[] args) {
        Fibonacci tmp = new Fibonacci();
        int a = System.in.read();

        System.out.write(tmp.fibonacci(a));
        System.out.flush();
    }

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