123456789101112131415161718192021222324252627 |
-
- import java.math.BigInteger;
-
- //Write a program that computes the factorial n! = 1 x 2 x ... x n,
- //using BigInteger. Compute the factorial of 1000.
-
- public class Factorial {
-
- public BigInteger factorialOf(Integer value){
- int i = 1;
- int j = 1;
-
-
-
- for(i = 1; i <= value; i++){
- j=j*i;
- }
-
- //j is the factorial of value
-
- BigInteger x = BigInteger.valueOf(j);
-
- return x;
- }
-
- }
|