package bianchengti;
/*
* 输入一个整数n,输出契波那契数列的第n项
* 斐波那契数列:1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89...
*/
public class Fibonacci {
public static int FibValue(int n) {
if(n<=0) {
return 0;
}else if(n==1){
return 1;
}else if(n==2) {
return 1;
}else {
return FibValue(n-1)+FibValue(n-2);
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(FibValue(4));
} }