题目:用递归方法编写函数处理Fibonicci数列问题,编程并计算该数列的第七项值f(7)
其中: 1 (n = 1,2)
f(n) = f(n - 1) + f(n - 2) (n > 2)
#include<stdio.h>
int Fibonicci(int n);
int main()
{
int n;
scanf("%d", &n);
printf("Fibonicci(%d)=%d\n", n, Fibonicci(n));
return 0;
}
int Fibonicci(int n)
{
if (n == 1 || n == 2)
return 1;
else
return Fibonicci(n - 1) + Fibonicci(n - 2);
}