设此所求的数列为:0,1,1,2,3,5,8,13,21,……(n=0,1,2,3,……)
#include<stdio.h>
long Fibonacci(int n)
{
if(n==0||n==1)
return (long)n;
else
return Fibonacci(n-1)+Fibonacci(n-2);
}
int main()
{
int n;
scanf("%d",&n);
printf("F(%d)=%ld\n",n,Fibonacci(n));
getch();
return 0;
}