用递归算法实现斐波那契数列显示
<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>