title: averaging while looping, the sum won't clear and thus keeps adding numbers from previous loop entry
body: <pre><code> #include &lt;stdio.h&gt;
  
   int main () {
   int days, flights, t, b;
   float length, mean, sum;
  
   printf("How many days has your dragon been practicing?\n");
   scanf("%d", &amp;days);
  
   for(t=1; t&lt;=days; t++) {
      printf("How many flights were completed in day #%d?\n", t);
      scanf("%d", &amp;flights);
      for(b=1; b&lt;=flights; b++) {
          printf("How long was flight #%d?\n", b);
          scanf("%f", &amp;length);
          sum+=length;
       }
          mean = sum/flights;
          printf("Day #%d: The average distance is %.3f.\n", t, mean);
  
  }
  
  }
  </code></pre>
  
  <p>the sum used to calculate the mean is supposed to be only the number from one iteration of the loop added together. instead the sum used numbers from the new iteration and old iteration added together.</p>