title: How can I write a program that has an input of n and then calculates the sum of n numbers that the user enters?
body: <p>I've written this so far:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  
  int main()
  {
      int n = 0, i = 0, sum = 0, a = 0;
      scanf("%d", &amp;n);
      while (i &lt;= n);
      {
          scanf("\n%d", &amp;a);
          sum = sum + a;
          i++;
      }   
      printf("%d", sum);
  }
  </code></pre>
  
  <p>but when I enter 8, for example, it won't allow me to add any other numbers. </p>
  
  <p>What's the problem?</p>