/*
* Copyright (c) 2014,烟台大学计算机学院
* All rights reserved.
*文件名称: test.cop
*作者:翟兴雷
*完成日期:2014年11月13日
*版本号:v1.0
*
*问题描述:求1*3*...n的递归式
*输入描述:
*程序输出:
*/
#include <iostream>
using namespace std;
int fib(int n);
int main(){
cout<<fib(20)<<endl; //输出
return 0;
}
//返回Fibnacci序列中的第n个数
int fib(int n)
{int f;
if(n==1||n==2)
f=1;
else f=fib(n-1)+fib(n-2) ;
return f;
}
Fibnacci是从百度上查的啊,