练习题2016.11.14
来源:互联网 发布:怎么开通淘宝直播间 编辑:程序博客网 时间:2024/06/05 08:54
1,函数的嵌套,4个整数的最大值
#include <stdio.h>int main(){ int a; int b; int c; int d; int max; int max4(int a,int b,int c,int d); printf("please enter 4 interger number:"); scanf("%d%d%d%d",&a,&b,&c,&d); max = max4(a,b,c,d); printf("max=%d\n",max); return 0;}int max4(int a,int b,int c,int d){ int m; int max2(int a,int b); m = max2(a,b); m = max2(m,c); m = max2(m,d); return(m);}int max2(int a,int b){ if(a >= b) { return a; } else { return b; }}
2,递归求n!
#include <stdio.h>int main(){ int n; int y; int fac(int n); printf("input an integer number:"); scanf("%d",&n); y = fac(n); printf("%d != %d\n",n,y); return 0;}int fac(int n){ int f; if(n < 0); { printf("n < 0,data error!"); } else { f = 1; } else { f = fac(n - 1) * n; } return (f);}
0 0
- 练习题2016.11.14
- 练习题2016.11.14
- 练习题2016.11.7
- 练习题2016.11.8
- 练习题2016.11.9
- C++之练习题14
- 练习题
- 练习题
- 练习题
- 练习题
- 练习题
- 练习题
- 练习题
- 练习题
- 练习题
- 练习题
- 练习题
- 练习题
- 扩展欧几里得noip2012同余方程
- KMP算法详细解读
- FAESOR Matlab object-oriented Finite Element toolkit
- angular的动画ngAnimate模块
- MyEclipse2015 快捷键
- 练习题2016.11.14
- 建图的思想codevs1364寻宝
- 解决ThinkJS项目开发中页面跳转报错问题
- Oracle11完全卸载方法
- 前端人员跳槽前,这些算法你都会了吗?
- 第六周
- 再探ListView数据展示
- 帕斯瓦尔定理(Parseval's theorem)
- 像电影里黑客高手一样敲代码攻击入侵网站