title: First value of an array in Insertion Sort
body: <p>I am trying to use insertion sort to sort an array. However, when applying it, it does not include the first element of the array in the ranking. What could be the reason?</p>
  <p>Here is my code below:</p>
  <pre><code>namespace InsertionSort
  {
      class Program
      {
          static void Main(string[] args)
          {
              int min = 0, max = 40;
              int[] array1 = new int[10];
              Random randNum = new Random();
              for (int i = 0; i &lt; array1.Length; i++)
              {
                  array1[i] = randNum.Next(min, max);
              }
              foreach (var item in array1)
              {
                  Console.WriteLine(item);
              }
              Console.WriteLine(&quot;***************&quot;);
              
              for (int j = 1; j &lt; array1.Length; j++)
              {
                  int key,i;
                  key = array1[j];
                  i = j - 1;
                  while ((i&gt;0)&amp;&amp;array1[i]&gt;key )
                  {
                      array1[i + 1] = array1[i];
                      i = i - 1;
                  }
                  array1[i + 1] = key;
              }
              foreach (var item in array1)
              {
                  Console.WriteLine(item);
              }
          }
      }
  }
  </code></pre>
  <p>And here is my output:
  <a href="https://i.stack.imgur.com/vNVrS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vNVrS.png" alt="enter image description here" /></a></p>