week_10
2014-04-29 20:15
288 查看
【1】使用递归函数,计算斐波那契数列,输出第35个数。
#include "stdio.h" long Fibonacci (int n) { int a; if(n>2) return Fibonacci(n-1)+Fibonacci(n-2); else return 1; } main() { printf("the 35th is %d\n",Fibonacci(35)); }【2】使用递归函数,计算8!
#include "stdio.h" long rfact (int n) { long ans; if(n>0) ans=n*rfact(n-1); else ans=1; return ans; } main() { int a; a=rfact(8); printf("the 8th is %d\n",a); }
相关文章推荐
- Leetcode:23. Merge k Sorted Lists (week 10)
- Decode String_Week10
- Week 10算法分析作业
- 【Machine Learning】【Andrew Ng】- Quiz(Week 10)
- <<Oracle Applications DBA 基础(第二期)>>Week 10 exercise
- 算法分析与设计week10--349. Intersection of Two Arrays
- week10:PHP面向对象的程序设计之10大知识点
- 《算法分析与设计》Week 10
- C程序设计Week10课上实例
- 团队项目M1展示成绩和Week 10分数
- C程序设计week10作业
- Machine Learning(Andrew)Week10(上)
- Machine Learning - XVIII. Application Example Photo OCR应用实例-照片OCR(Week10)
- week 10
- week 10 的遗留问题
- 算法设计Week10 LeetCode Algorithms Problem #213 House Robber II
- week10(下)
- Machine Learning - XVII. Large Scale Machine Learning大规模机器学习 (Week 10)
- LeetCode#712 Minimum ASCII Delete Sum for Two Strings (week10)
- [PTA] week12 4-10 Strongly Connected Components