/*
*Copyright (c) 2016,烟台大学计算机学院
*All rights reserved.
*文件名称:text.cpp
*作者:陈腾
*完成日期:2016年4月03日
*版本号:v1.0
*
*问题描述:递归求Fibnacci数,输出Fibnacci的第20个数
*输入描述:无
*程序输出:输出第二十个数
*/
#include <iostream>
using namespace std;
int fib(int n);
int main()
{
cout<<fib(20)<<endl;
return 0;
}
int fib(int n)
{
if(n==1)
return 0;
else if(n==2)
return 1;
else
{
return fib(n-1)+fib(n-2);
}
}