title: In C programming why is my printf not printing after a loop?
body: <p>I need to print the sum and average of user input array. So if user inputs 2,4,6,9,10 it should print 6. 
  However, after the loop ended my printf is not printing anything. </p>
  
  <p>Even if I put the printf inside the array it only prints out 0.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  
  int main()
  {
      int i;
      double num[6],average, sum=0, closest;
      printf("Enter 6 doubles\n");
  
      for (i=0; i&lt;6; i++)
      {
      scanf("%lf",&amp;num[i]);
      sum += num[i];
  
      }
      average = sum/i;
      printf("Average %d", average); 
  }
  </code></pre>