팩토리얼 재귀
class facto{
int fact(int number){
if(number == 1) return 1;
if(number == 2) return 2;
return number * fact(number-1);
}
}
public class FactorialTest {
public static void main(String[] args) {
// 명령형 매개변수 5 == 5!
int input = Integer.parseInt(args[0]);
if(input==0){
System.out.println("잘못 입력하셨습니다.");
return;
}
facto f = new facto();
System.out.println(input+"!="+f.fact(input));
}
}