Skip to content

Instantly share code, notes, and snippets.

@rahulkmr
Created February 7, 2010 07:18
Show Gist options
  • Save rahulkmr/297271 to your computer and use it in GitHub Desktop.
Save rahulkmr/297271 to your computer and use it in GitHub Desktop.
public class FibNum {
public static void main(String args[]) {
System.out.printf("%.0f\n", fib(Integer.parseInt(args[0])));
}
public static double fib(int n) {
if (n <= 1)
return 1;
else
return fib(n-1) + fib(n-2);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment