title: How to fix the code for " e = 1 + 1/1! + 1/2! + 1/3! + ...... + 1/n! "?
body: <p>This is what I came up with:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main (void)
  {
    int n, i, j;
    float e = 1.0, nFact = 1.0;
  
    printf ("please enter the number");
    scanf ("%d", &amp;n);
  
    for (i = 1; i &lt;= n ; i++)
    {
      for (j = 1; j &lt;= i; j++)
      {
        nFact *= j;
      }
      e = e + (1.0 / nFact);
    }
  
    printf ("The value of 'e' is : %f", e);
    return 0;
  }
  </code></pre>
  
  <p>This is what I get from this code.
  Input: 3
  Output: 2.58333 (which is close to 2.6666...)</p>
  
  <p>But for n=3, e should give 2.6666.. as a value.</p>
  
  <p><strong>Am I doing something wrong here? How can I get the proper output?</strong></p>