123456789101112131415161718192021222324 |
-
- import java.util.Scanner;
- import java.math.BigInteger;
-
- public class Factorial {
-
- public BigInteger factorialOf(Integer value){
-
- Scanner scanner = new Scanner(System.in);
- System.out.println("Enter a number: ");
- int userInput = scanner.nextInt();
- int counter = userInput;
- BigInteger result = BigInteger.ONE;
- for(int i=1; i <counter; i++){
- value = value*i;
- }
-
-
- System.out.println(value);
- return result.multiply(BigInteger.valueOf(value));
- }
-
- }
|