title: Factorial - Array - C++
body: <p>The problem is to compute factorial of a number. I've debugged my code, and it works fine for any input and produces <strong>correct</strong> output for all the given test cases. But still, I'm getting Wrong Answer on SPOJ. </p>
  
  <p><strong>Problem:</strong></p>
  
  <p>An integer t, 1&lt;=t&lt;=100, denoting the number of testcases, followed by t lines, each containing a single integer n, 1&lt;=n&lt;=100.</p>
  
  <p>Any insight would be helpful. Am I missing some critical test cases?</p>
  
  <p><strong>My Code:</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  int main()
  {
  
  long T;
  cin&gt;&gt;T;
  while(T--)
  {
      long long N;
  
      long long index, count;
      cin&gt;&gt;N;
      long long a[300];
      long long i=1;
      a[0]=1; count=1;
      while(i&lt;=N)
      {
  
          long long z=0;
          long long k; long long x;
          long long j=i;
          long long temp=0; long long current=0;
          for(k=0; k&lt;count;k++)
          {
              x=(a[k]*j)+temp;
              a[k]=x%10;
              temp=x/10;
          }
          if(temp&gt;0)
              while(temp&gt;0)
              {
                  a[k]=temp;
                  temp=temp/10;
                  k++;
                  count++;
              }
  
  
          i++;
      }
  
  
      for(long long g=count-1; g&gt;=0; g--)
          cout&lt;&lt;a[g];
          cout&lt;&lt;"\n";
  
  }
  return 0;
  }
  </code></pre>