Java :
static void extraLongFactorials(int n) {
BigInteger factorial = new BigInteger("1");
for(int i = 1; i <= n; i++){
factorial = factorial.multiply(BigInteger.valueOf(i));
}
System.out.println(factorial);
}
Explanation:
This question is so much easier done in Java, since Java has the BigInteger class that supports huge numbers. Another language that supports these big numbers is Ruby.
The for loop goes from i = 1 to n, such that the factorial multiplies by i in each loop until it is equal to n.