title: Finding the column total in an array
body: <p>I have an 1-dimensional array with random elements, got through a m*n grid. I want to find out the row total and column total, present in it.</p>
  
  <p>Here is how the 1 dimensional array is:
  [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]</p>
  
  <p>I want to treat it like :</p>
  
  <p><code>01</code>  <code>02</code>   <code>03</code>  <code>04</code>   <code>05</code></p>
  
  <p><code>06</code>   <code>07</code>   <code>08</code>  <code>09</code>   <code>10</code></p>
  
  <p><code>11</code>  <code>12</code>  <code>13</code>  <code>14</code>  <code>15</code></p>
  
  <p><code>16</code> <code>17</code> <code>18</code> <code>19</code> <code>20</code></p>
  
  <p>Now i want to find the reo total and column total.
  Row total is done as follows:</p>
  
  <pre><code>for (int i = 0; i &lt; totalRows; i++)
          {
              for (int j = 0; j &lt; totalColumns; j++)
              {
                  rowTotal[i] += numbers[temp + j];
              }               
              temp += totalColumns;
          }
  </code></pre>
  
  <p>I am trying to do the same with Column.
  Here is the code:</p>
  
  <pre><code>for (int i = 0; i &lt; totalColumns; i++)
          {
              tempk = 0;
  
              for (int j = 0; j &lt; totalRows; j++)
              {
                  blockTotal[i] += numbers[i+j+tempk];
                 tempk += totalColumns;
  
              }
          }
  </code></pre>
  
  <p>Am not able to get the column total, as intended. Please Help.</p>