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

  

posted @ 2015-03-22 10:24  无心流泪  阅读(169)  评论(0编辑  收藏  举报