WA for FCTRL2.

#include<stdio.h>

void B(int k);
int a[200];
int sum,i;
int main()
{     int k,n,o,l,t,j;
      scanf("%d",&t);
      for(j=1;j<=t;j++)     
            {scanf("%d",&n);
             for(i=2;i<=170;i++)
                  a[i]=0;
                 
                  a[0]=0;
                  a[1]=1;
                  k=1; 
             for(i=1;i<=n;i++)
                  {sum=0;
                   a[k]=a[k]*i+sum;              
                   B(k);  
                  } 
     
              
              for(o=200;o>=1;o--)
                  {if(a[o]>0)
                       {
                             l=o;
                              break;
                       }                 
                  } 
      
      for(i=l;i>=1;i--)
      printf("%d",a[i]);
      printf("\n");
      
      
      }
      
      return 0;
      }
void B(int k)
{int m;
      for(m=1;m<=170;m++)               
     {
     sum=a[k]/10;            
     a[k]=a[k]%10;  
     k++;
     
     
     a[k]=a[k]*i+sum;
     
     }
     
}

I think the problem is in the loop where you are checking first non-zero digit . you have made your zero upto 170 th place and u are checking from 200th digit , that may contain a junk value .(If not at the 200th place at any other place from 170 to 200 , so either make your array zero upto 200th place(which is not necessary as size of 100! is 158) or check from 170th place .

Here is corrected code :-
#include<stdio.h>

void B(int k);
int a[200];
int sum,i;
int main()
{ int k,n,o,l,t,j;
scanf("%d",&t);
for(j=1;j<=t;j++)
{scanf("%d",&n);
for(i=2;i<=170;i++)
a[i]=0;

              a[0]=0;
              a[1]=1;
              k=1; 
         for(i=1;i<=n;i++)
              {sum=0;
               a[k]=a[k]*i+sum;              
               B(k);  
              }


          for(o=170;o>=1;o--)
              {if(a[o]>0)
                   {
                         l=o;
                          break;
                   }                 
              }

  for(i=l;i>=1;i--)
  printf("%d",a[i]);
  printf("\n");


  }

  return 0;
  }

void B(int k)
{int m;
for(m=1;m<=170;m++)
{
sum=a[k]/10;
a[k]=a[k]%10;
k++;

 a[k]=a[k]*i+sum;

 }

}

Hope it works.

//