#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std ;
int feibo(int n)
{
if(n==1||n==2)
return 1;
return feibo(n-1)+feibo(n-2);
}
int main() {
int n,res;
cin>>n;
res=feibo(n);
cout<<res;
return 0;
}
用递归求fibonacci级数
最新推荐文章于 2024-07-17 20:43:45 发布