title: How could I calculate several means using one set of user inputs?
body: <p>I am trying to calculate an arithmetic, geometric, and harmonic mean as well as a standard deviation, after prompting a user to input 5 integers. </p>
  
  <p>I have the arithmetic mean working well. Its the others after it that are troublesome.. I am almost positive it is because of my structuring, but I just am not sure what to change after researching online and in my textbook... and any help is appreciated with this!</p>
  
  <p>Here is the code:</p>
  
  <pre><code>#include &lt;math.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  float a_mean;
  float g_mean;
  float h_mean;
  float st_dev;
  sum1 = 0; sum2 = 0; sum3 = 0;
  float data[100];
  n = 5;
  int i;
  
  int main()
  {
  
      printf("Please Enter Five Integers:\n"); /* Prompts user input */
  
              for ( i = 0; i &lt; n; ++i)
                  {
                      scanf("%f", &amp;data[i]);
                      sum1 = sum1 + data[i];
                  }
              a_mean = sum1 / n;
  
                  {
                      sum2 = sum2 * data[i];
                  }
              g_mean = pow(sum2, 1 / n);
  
                  {
                      sum3 = sum3 + ( 1 / data[i] );
                  }
              h_mean = n / sum3;
  
      printf("Arithmetic mean: %0.2f\n", a_mean);
      printf("Geometric mean: %0.2f\n", g_mean);
      printf("Harmonic mean: %0.2f\n", h_mean);
  
      return 0;
  }
  </code></pre>
  
  <p>I know its probably something basic with my for-structuring, but I simply don't know a lot about this stuff yet, so thanks in advance</p>
  
  <p>**Also, disregard the fact that I haven't attempted to form my calculation/output for the standard deviation yet. Thanks</p>