title: Calculating e using loops
body: <p>I'm trying to calculate e iteratively, but my code gives me 2. Any idea what could be wrong? Because I'm completely stuck.</p>
  
  <pre><code>public class iteratee {
  
      public static void main(String[] args) {
  
          long limit = 0;
  
          for (int i = 0; i &lt; 11; i++) {
  
              limit = limit + 1/factorial(i);
  
          }
  
          System.out.println(limit);
  
      }
  
      static int factorial(int n) {
  
          int factorial = 1;
  
          for (int j = 1; j &lt;= n; j++) {
              factorial = factorial * j;
          }
  
          return factorial; 
  
      }
  
  }
  </code></pre>