第四周项目4—输出第20个数
2016-04-20 15:47
204 查看
/* 02.烟台大学计算机学院 03.文件名称:xiangmu4.cpp 04.版本号;code block 05.作者:李亚辉 06.完成日期:2016年4月20日 07.问题描述:编制递归函数fib(int n)返回第n个Fibnacci数,以此输出Fibnacci序列的第20个数 08.输入描述:无 09.程序输出:输出第20个数 10.*/ #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)); }
相关文章推荐
- 为Spring添加REST功能
- 人月神话 读书笔记01
- ios 图文并排功能 NSMutableAttributedString
- dataTables/ajax/struts2/jquery的用户管理表实现
- web.xml中配置applicationContext.xml 配置文件的存放位置
- PL/0 词法分析器设计 c语言
- 五家公司市值超2.2万亿美元!亚马逊谷歌Facebook被评“买入”,微软苹果呢?
- iOS中对字符串进行md5加密算法
- GCD 第一篇 dispatch_async;dispatch_sync;dispatch_async_f;dispatch_sync_f
- eas用户密码的加密和解密
- 使用struts2 urlrewrite 实现页面伪静态
- 权限管理程序
- 团队作业三
- C语言中的函数指针学习笔记
- 1、Jenkins安装
- Contextual Tab开发相关
- c3p0源码解析 六 (C3P0PooledConnectionPoolManager类)
- runtime - 方法动态添加
- Laravel 上传excel,读取并写入数据库 (实现自动建表、存记录值
- 对象传递