斐波那契数列计算

public class TestFeiBoNaQi {

public static void main(String[] args) {

TestFeiBoNaQi t = new TestFeiBoNaQi();

System.out.println(t.getFB(5));

}

public int getFB(int i){

if(i==1||i==2)

 return 1;

else

return getFB(i-1)+getFB(i-2);

}

}

点赞