forked from RyanFehr/HackerRank
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolution.java
More file actions
24 lines (19 loc) · 750 Bytes
/
Solution.java
File metadata and controls
24 lines (19 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//Problem: https://www.hackerrank.com/challenges/extra-long-factorials
//Java 8
import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner input = new Scanner(System.in);
int N = input.nextInt();
BigInteger factorial = new BigInteger("1");
for(int i = 2; i <= N; i++)
{
BigInteger multiplier = new BigInteger(String.valueOf(i));
factorial = factorial.multiply(multiplier);
}
System.out.println(factorial);
}
}