Fibonacci数列
public class Fibonacci { public static void main(String args[]){ int nums = fibonacci(Integer.valueOf(args[0])); System.out.println(nums); } static int fibonacci(int n){ if(n <= 1) return 1; return fibonacci(n-1) + fibonacci(n-2); } }
public class Fibonacci { public static void main(String args[]){ int nums = fibonacci(Integer.valueOf(args[0])); System.out.println(nums); } static int fibonacci(int n){ if(n <= 1) return 1; return fibonacci(n-1) + fibonacci(n-2); } }