package chapterone;
import java.util.Scanner;
public class Exercise1_1_20 {
public static int fac(int n) {
if (n - 1 == 1) {
return n;
} else {
return n * fac(n - 1);
}
}
public static void main(String[] args) {
int num;
Scanner scan = new Scanner(System.in);
while (true) {
num = scan.nextInt();
System.out.println(fac(num));
}
}
}
Exercise1_1_20
最新推荐文章于 2016-02-24 10:57:11 发布