title: sum middle number with jagged array in C#
body: <p>I write some code with jagged array but when i sum middle number program not working and i cant fix it...:</p>
  
  <pre><code> public class JaggedArray
  { 
      public static void Array()
      {
          int[][] arrayOfArray = ArrayOfArray();
          var tong = 0;
          for (var i = 1; i &lt; arrayOfArray.Length; i++)
          {
              for (var j = 0; j &lt; arrayOfArray[i].Length; j++)
              {
                  var bienTam = arrayOfArray[i].Length;
                  var tamThoi = j;
                  if (bienTam%2==0&amp;&amp;tamThoi==bienTam/2) 
                  {
                      tamThoi++;
                      tong += arrayOfArray[i][tamThoi];
                  }
              }
          }
          OutPut(arrayOfArray, tong);
      }
  
  private static int[][] ArrayOfArray()
      {
          Random ngauNhien = new Random();
          int[][] arrayOfArray = new int[13][];
          for (var i = 0; i &lt;arrayOfArray.Length; i++)
          {
              arrayOfArray[i] = new int[i];
              for (var j = 0; j &lt; arrayOfArray[i].Length; j++)
              {
                  arrayOfArray[i][j] = ngauNhien.Next(0, 99); //throw exception
  
              }
          }
  
          return arrayOfArray;
      }
  </code></pre>
  
  <p>can someone explain reason why i wrong and how ti fix it?</p>