Skip to content

Instantly share code, notes, and snippets.

@charity1475
Created January 23, 2024 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charity1475/6d408aac4ff1d4c3d5627b8ab1c73c61 to your computer and use it in GitHub Desktop.
Save charity1475/6d408aac4ff1d4c3d5627b8ab1c73c61 to your computer and use it in GitHub Desktop.
BigInteger
import java.math.BigInteger;
import java.util.Scanner;
class Result {
/*
* Complete the 'extraLongFactorials' function below.
*
* The function accepts INTEGER n as parameter.
*/
public static void extraLongFactorials(int n) {
BigInteger factorial = BigInteger.ONE;
while (n>0){
factorial = factorial.multiply(BigInteger.valueOf(n));
n--;
}
System.out.println(factorial);
}
}
public class NTHFactorial {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
scanner.close();
Result.extraLongFactorials(n);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment