函数的递归
2014-06-11 07:07
281 查看
函数的递归和循环:
#include <stdio.h> int main(void) { char i,s; for(i = 1,s = 1;i <=4;i++) { s *= i; } printf("%d\n",s); return 0; }
/* 用递归来实现一把 */ #include <stdio.h> long test(int); int main(void) { } long test(int n) { long f; // printf("%d\n",n); if(n > 1) { f = test(n - 1)*n; // printf("%d\n",n); } else { // printf("%d\n",n); f = 1; } return 0; }
相关文章推荐
- Linux下递归删除路径的函数
- 递归列出所有文件和目录 (函数)
- 一个递归小函数,用于组合树控件的文本
- 利用递归把多维数组转为一维数组的函数
- 利用游标实现递归(函数)
- 函数递归调用
- 函数:递归分类
- PHP递归创建目录函数
- [原创]用递归写的一个object 转换成JSON的函数
- 使用"函数递归"实现的树型菜单
- 使用函数递归实现基于php和MySQL的动态树型菜单
- 递归用函数、存储过程实现的效果
- Java 学习笔记 (10) - Java 函数的递归调用
- 使用函数递归实现基于php和MySQL的动态树型菜单
- 使用"函数递归"实现的树型菜单 (转)
- 关于Oracle中split函数的实现以及函数递归的举例。
- 利用递归把多维数组转为一维数组的函数
- 函数的递归调用
- 函数的递归调用
- 函数的递归和调用