title: i want to find factorial of 'n' number of numbers in c++
body: <p>I want to find factorial of n number of numbers and it seems the code is right. But why does the program output a wrong answer?</p>
  
  <p><strong>Sample input</strong></p>
  
  <p>4</p>
  
  <p>1</p>
  
  <p>2 </p>
  
  <p>3</p>
  
  <p>4</p>
  
  <p><strong>Samplw Output</strong></p>
  
  <p>1</p>
  
  <p>2</p>
  
  <p>6</p>
  
  <p>24</p>
  
  <p>See the output is correct but idk why the website says wrong answer?</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main() {
    int t, n, f;
    cin &gt;&gt; t;
    while (t &gt; 0) {
      f = 1;
      cin &gt;&gt; n;
      while (n &gt; 0) {
        f = f * n;
        n--;
      }
      cout &lt;&lt; f &lt;&lt; "\n";
      t--;
    }
    return 0;
  }
  </code></pre>