title: C# array sort explanation
body: <p>Can someone please explain how the for loops works here after iterating through all indexes. I'm not understanding how the for loops are working again and again until all the numbers are sorted. </p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          int[] arr = new int[] {9,1,6,3,7,2,4};
          int temp = 0;
  
          for (int i = 0; i &lt; arr.Length; i++)
          {
              for (int j = i + 1; j &lt; arr.Length;j++)
              {
                  if(arr[i]&gt;arr[j])
                  {
                      temp = arr[j];
                      arr[j] = arr[i];
                      arr[i] = temp;
                  }
              }
  
              Console.Write(arr[i]+",");
          }
               Console.ReadLine();
      }
  </code></pre>