title: has a bug in this program to find the factorial of numbers 1 to 20 in java
body: <p>this code is working fine for numbers 1 to 12 but after that its showing the wrong result can somebody explain ?</p>
  
  <pre><code>package logicProgramming;
  
  import java.util.Scanner;
  
  public class Factorial {
  
  public static void main(String[] args) {
      // TODO Auto-generated method stub
      Scanner KB=new Scanner(System.in);
      int t=KB.nextInt();
      while (t--&gt;0)
      {
          int b=KB.nextInt();
          if(b&gt;0 &amp;&amp; b&lt;21)
          {
              int f=b;
              for(int i=1;i&lt;b;i++){
                  f=f*i;
               }
               System.out.println(f);
          }
      }
      }
  }
  </code></pre>