十以内阶乘
import java.util.Scanner;
public class 阶乘 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("输入一个数字");
int n = sc.nextInt();
System.out.println("结果为:"+f(n));
}
public static int f(int n){
int sum = 1;
for(int i = 1;i <= n;++i){
sum *= i;
}
return sum;
}