title: How do I calculate sum of (2i+1)! using while loop?
body: <p>I'm writing console program in visual studio now.<br>
  My program should calculate the sum of following series: </p>
  
  <pre><code>1!+3!+5!+...+(2N+1)!,  
  </code></pre>
  
  <p>where <code>N</code> is integer number greater then <strong>0</strong> (user should enter N first).</p>
  
  <p>Unfortunately, I only can calculate sum of <code>1!+2!+3!+...(N)!</code></p>
  
  <pre><code>/* Calculates sum of 1!+2!+3!+...+(N)! */
  
  #include &lt;iostream&gt;
  using namespace std;
  
  int main()
  {
  
      int i=1, n, fact = 1, sum = 0;
  
      cout&lt;&lt;"Enter n";
      cin &gt;&gt; n;
  
      while(i &lt;= n)
      {
          fact = fact * i;
          i++;
          sum = sum + fact;
      }
  
      cout&lt;&lt;"Sum is "&lt;&lt;sum&lt;&lt;"\n";
      return 0;
  }    
  </code></pre>
  
  <p>So how do I make my program to calculate the sum of</p>
  
  <pre><code>1!+3!+5!+...+(2N+1)!
  </code></pre>