题解 | #斐波那契数列#
斐波那契数列
http://www.nowcoder.com/practice/c6c7742f5ba7442aada113136ddea0c3
/** *
- @param n int整型
- @return int整型
- C语言声明定义全局变量请加上static,防止重复定义 */
-
- //本题运用到了递归的方法,根据斐波那契数列表达式即可写出对应函数功能
-
1.* int Fibonacci(int n ) {
-
-
// write code here
-
-
-
if(n == 1 || n == 2){
-
-
-
return 1;
-
-
-
}
-
-
-
else{
-
-
-
return Fibonacci(n-1)+Fibonacci(n-2);
-
-
-
}
-
-
-
}
-