首页 > 学院 > 开发设计 > 正文

IO流_递归解决问题的思想及图解

2019-11-11 04:02:04
字体:
来源:转载
供稿:网友
package cn.itcast_02;/* * 需求:请用代码实现求5的阶乘 * 下面的知识要知道: * 		5! = 1*2*3*4*5 * 		5! = 5*4! *  * 有几种方案实现呢? * 		A:循环实现 * 		B:递归实现 */public class DiGuiDemo {	public static void main(String[] args) {		int jc = 1;		for (int x = 2; x <= 5; x++) {			jc *= x;		}		System.out.PRintln("5的阶乘是:" + jc);	}}


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表