dComArk15/Aflevering5-x86-64/Fib.java

17 lines
333 B
Java
Raw Normal View History

2016-01-03 12:29:05 +00:00
public class Fib {
public static long fib(long n) {
if (n == 0) return 0;
if (n == 1) return 1;
return fib(n-1) + fib(n-2);
}
public static void main(String[] args) {
long a = 0;
long r = 0;
a = Long.parseUnsignedLong(args[0]);
r = fib(a);
System.out.println("fib("+ Long.toUnsignedString(a) + ") = " + r);
}
}