Created
January 23, 2024 20:30
-
-
Save charity1475/6d408aac4ff1d4c3d5627b8ab1c73c61 to your computer and use it in GitHub Desktop.
BigInteger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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