dComArk15/Aflevering5-x86-64/Fib.java
Christoffer Müller Madsen e2e36f9f0d initial commit
2016-01-03 13:29:05 +01:00

17 lines
333 B
Java

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);
}
}