728x90
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
if(n>=0 && n<=12) {
int x = fact(n);
System.out.println(x);
}
}
private static int fact(int n) {
if(n == 1 || n ==0) return 1;
else return n * fact(n-1);
}
}
728x90
'PS > BaekJoon' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
3052 JAVA ๋๋จธ์ง (0) | 2022.06.30 |
---|---|
2439 JAVA ๋ณ์ฐ๊ธฐ -2 (0) | 2022.06.22 |
10699 JAVA ์ค๋ ๋ ์ง (0) | 2022.06.20 |
2420 JAVA ์ฌํ๋ฆฌ์๋ (0) | 2022.06.20 |
1271 JAVA ๋ฐฑ์ค ์์ฒญ๋ ๋ถ์2 (0) | 2022.06.20 |