title: Get first col in matrix
body: <p>I have simple program that gets the sum of main and anti diagonals of a matrix. And then it get the sum of first and last column of a matrix.For example:<br></p>
  <pre><code>1 2 3
  4 5 6  --&gt; The matrix
  7 8 9
  
  md = 1 + 5 + 9 = 15
  ad = 7 + 5 + 3 = 15
  lastCol = 3 + 6 + 9 = 18
  firstCol = 1 + 4 + 7 = 12
  </code></pre>
  <p><em><strong>How can i get the sum of the firstCol of a square matrix ?</strong></em><br> Here is my code:</p>
  <pre><code>int main(){
      int n;
          scanf(&quot;%d&quot;,&amp;n);
          int i,j,a[n][n],firstCol=0,lastCol=0,md=0,ad=0;
          for(i = 0;i &lt;n;i++){
              for(j=0;j&lt;n;j++){
                  scanf(&quot;%d&quot;,&amp;a[i][j]);
              }
          }
          for(i = 0;i &lt;n;i++){
              for(j=0;j&lt;n;j++){
                  if(i==j){
                      md+=a[i][j];
                  }
                  if(i+j==n-1){
                      ad+=a[i][j];
                  }
              }
          }
          for(i=0;i&lt;n;i++){
                  lastCol+=a[i][n-1];
          }
  }
  </code></pre>