Help needed in FCTRL2

My code and output is correct but when I submit it says my program is wrong. Here’s my code :

import java.util.Scanner;

class CodeChef
public static void main (String[] args)
int fact=1;int a;
Scanner sc = new Scanner(;
int t=sc.nextInt();

  for(int i=0;i<t&&t>=1&&t<=100;i++)
        while (a!=0&&a>=1&&a<=100)


Your code is right but you see factorials of a number is very large int can’t store above factorial of 20( that too i doubt) even long long or unsigned 64-bit integer can’t store value of 100!(unsigned 64-bit integer can store value upto 19 digits whereas 100! is 150+ digits)you need to be cleverer here see this has the solution

Have a look at this. You are doing same mistake->

I think you should use Big integer in Java

Ps:- I am not so sure about big int thing

not possible