Wrong Answer in the FCTRL2 problem

Ive been trying to submit the soluton for this problem. Initialyy when i used the a size of 16 for the testArr[] it gave me an SIGSEGV error. But for this code, there is no error but the wrong answer notification pops up. Though the answer is correct when i try to run it on any other IDE.

Here my code:

 #include <iostream>
 #include <stdio.h> 
 using namespace std;

 int main(void) {

  int testCases,i,j,k,n,num,digits,carry=0,temp;
 scanf("%d",&testCases);
 int testArr[1000];


 for(i=0;i<testCases;i++){
scanf("%d",&n);
num=n;
if(n == 0 || n==1){
    testArr[0]=1;
    digits=1;
}
else{
    k=0;
    for(j=10;n!= 0;j=j*10){
        testArr[k]= n%j;
        n=n/j;k++;
    }
    digits=k;
    for(j=1;j<num;j++){
        for(k=0;k<digits;k++){
            temp = testArr[k] * j + carry;
            
            if(temp>10){
                testArr[k] = temp%10;
                carry = temp/10;
            }
            else{
                testArr[k] = temp;
                carry=0;
            }
        }
            if(carry > 10){
                testArr[k]=carry%10;
                k++;
                testArr[k]=carry/10;
                digits=k+1;
                carry=0;
            }
            else if(carry >0){
                testArr[k]=carry;
                digits=k+1;
                carry=0;
            }     
        }
    }
    
     for(k=(digits-1);k>=0;k--){     
        printf("%d",testArr[k]);
     }
     printf("\n");
}



 return 0;
 }

bro if you enter input 100 output will be 0 because 100! is out of range so see about booster file in c++ you will get answer