i had solve a problem on factorial but i am getting an error i had run that in my code block and i didnot get any error

please check my error

CodeChef | Competitive Programming | Participate & Learn | CodeChef

Which problem? What error?

You gotta provide more details if you want help

wrong answer is coming but it

You cannot store 100! in any of the data types in C/C++/Java as 100! is very very large.

So you have three options-

- Use python
- Use external boost library
- Use string to calculate factorial.

You can do 100! using BigInteger in Java. I solved that question using that data type.

I was talking about the primitive data types. BigInteger class in java is equivalent to boost in cpp.

check my codes i had use long int

try it using BigInteger class in java present in java.math.BigInteger as the resultant factorial can be very large and thus canβt be stored in long and int .

eg

int n=sc.nextInt(); //no of test cases//

for(int i=1;i<=n;i++){

int x=sc.nextInt(); //given number//

BigInteger bigint=new BigInteger(β1β);

for(int j=1;j<=x;j++){

bigint=bigint.multiply(BigInteger.valueOf(j));

}

System.out.println(bigint);

}

Range of long long int is 10^18. Whereas 100! contains about 158 digits.