25 lines
628 B
Java
25 lines
628 B
Java
// Author: Rodney Shaghoulian
|
|
// Github: github.com/RodneyShag
|
|
// HackerRank: hackerrank.com/RodneyShag
|
|
|
|
import java.util.Scanner;
|
|
import java.math.BigInteger;
|
|
|
|
public class Solution {
|
|
public static void main(String[] args) {
|
|
Scanner scan = new Scanner(System.in);
|
|
int n = scan.nextInt();
|
|
scan.close();
|
|
System.out.println(factorial(n));
|
|
}
|
|
|
|
private static BigInteger factorial(int n) {
|
|
BigInteger result = BigInteger.ONE;
|
|
while (n > 1) {
|
|
result = result.multiply(BigInteger.valueOf(n));
|
|
n--;
|
|
}
|
|
return result;
|
|
}
|
|
}
|