title: How to find the Average of column values in a 2D array?
body: <p>I want to print out the average of values in each column of a 2D Array. I've already figured out how to find the average across a row, but I am still struggling with doing that down a column.</p>
  
  <p>Here's what I have so far:</p>
  
  <pre><code> for ( i=0; i&lt;nRow; ++i)
      {
          for( j=0; j&lt;nCol+1; ++j)
          {
              if (j == nCol)
              {
                  nAve = (float)nSum/nCol;
                  printf("=%.1f", nAve);
              }
              else
              {
                  printf("%d\t", aArray[i][j]);
                  nSum += aArray[i][j];
              }
          }
  
          nSum = 0;
          printf("\n");
      }
  </code></pre>