斐波那契数列指的是这样一个数列 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144,、、、、、、、
Java编程:
public static int F(int num) {
if (num < 0 ) return -1;
if (num == 0) return 0;
if (num == 1) return 1;
if (num == 2) return 1;
if (num >= 3) return F(num-1)+F(num-2);
return num;
}