//普通方法打印十的阶乘
public static void factorial(int a){
int sum=1;
for (int k = 1; k <=a; k++) {
sum*=k;
}
System.out.println("sum:"+sum);
}
//使用递归算法实现
public static long factorial(int a){
if (a==1) {
return 1;
}else{
return a*factorial(a-1);
}
}