title: How to sum large numbers?
body: <p>I am trying to calculate <code>1 + 1 * 2 + 1 * 2 * 3 + 1 * 2 * 3 * 4 + ... + 1 * 2 * ... * n</code> where <code>n</code> is the user input.
  It works for values of <code>n</code> up to 12. I want to calculate the sum for <code>n = 13</code>, <code>n = 14</code> and <code>n = 15</code>. How do I do that in C89? As I know, I can use <code>unsigned long long int</code> only in C99 or C11.</p>
  
  <ol>
  <li>Input 13, result 2455009817, expected 6749977113</li>
  <li>Input 14, result 3733955097, expected 93928268313</li>
  <li>Input 15, result 1443297817, expected 1401602636313</li>
  </ol>
  
  <p>My code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  int main()
  {
      unsigned long int n;
      unsigned long int P = 1;
      int i;
      unsigned long int sum = 0;
      scanf("%lu", &amp;n);
      for(i = 1; i &lt;= n; i++)
      {
          P *= i;
          sum += P;
      }
      printf("%lu", sum);
      return 0;
  }
  </code></pre>