# 递归求阶乘和循环阶乘

public class Factorial {
static long sum=0;
static long factorial=1;
public static void main(String [] args){
java.util.Scanner in = new java.util.Scanner(System.in);
int count = in.nextInt();
for(int a=1; a<=count; a++){
factorial=factorial*a;
}
System.out.println(factorial);
}
}

/*递归求阶乘*/
public class RecursionRequestFactorial {
public long factorial(int request_number){
long value=0;
if(request_number ==1 || request_number ==0){
value =1;
}else if(request_number > 1){
value= request_number*factorial(request_number-1);
}
return value;
}
public static void main(String [] args){
java.util.Scanner in = new java.util.Scanner(System.in);
int request_number = in.nextInt();
RecursionRequestFactorial start = new RecursionRequestFactorial();
System.out.println(start.factorial(request_number));
}
}


#### C语言循环和递归两种方法求n的阶乘

2015-12-23 15:31:00

#### Scala脚本，用递归求阶乘和加和

2018-01-27 16:23:09

#### java 递归与非递归求n的阶乘

2012-10-30 21:44:00

#### 求阶乘 递归实现和非递归实现

2016-09-04 16:01:57

#### 用80x86汇编语言编程－－用递归方法求阶乘

2016-01-25 11:55:04

#### VB 递归求阶乘

2010年06月07日 36KB 下载

#### 用递归方法求n的阶乘。

2012-11-25 12:45:06

#### 用递归函数求阶乘

2012-11-26 10:05:57

#### 用汇编写的计算阶乘N!的程序

2010-07-09 11:43:00