用递归算法实现斐波那契数列显示(Java)

用递归算法实现斐波那契数列显示

<span style="font-family:Comic Sans MS;">public class RecursiveFun{
	public static void main(String[] args) {
		RecursiveFun rf =new RecursiveFun();
		for (int i=1;i<10; ++i) {
			System.out.println(""+rf.fiblibSum(i));
		}
	}
	int fiblibSum(int n){
		if (n==1 || n==2) 
			return 1;
		else
			return fiblibSum(n-1)+fiblibSum(n-2);
	}
}</span>
    原文作者:递归算法
    原文地址: https://blog.csdn.net/qq_24306261/article/details/51029755
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞