15 lines
253 B
Java
15 lines
253 B
Java
class Fib {
|
|
|
|
public static int fib(int n) {
|
|
if (n <= 1) {
|
|
return n;
|
|
} else {
|
|
return fib(n-1) + fib(n-2);
|
|
}
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
System.out.printf("%d\n", fib(Integer.parseInt(args[0])));
|
|
}
|
|
|
|
}
|