title: How to sort elements of an array using nested for-loops?
body: <p>I'm taking on a programming challenge for practice and I'm having trouble figuring this one out. It might be due to the time and my current sleepiness, but I want to get this done before bed.</p>
  
  <p>I want to sort the values of each element of an array in ascending order. The trick is not to use a sort() method. Here is what I have so far:</p>
  
  <pre><code>          for (int i = 0; i &lt; freq_array.Length; i++)
          {
              for (int n = 1; n &lt; i; n++)
              {
                  if (freq_array[n] &lt; freq_array[i])
                      freq_array[i] = freq_array[n];
              }
          }
  
          for (int x = 0; x &lt; freq_array.Length; x++)
          {
              lblOutDigits.Text = "";
              lblOutDigits.Text += freq_array[x];
          }
  </code></pre>
  
  <p>When testing it out, I just get a '0' in the label. What the freq_array does is hold the frequency of how often certain buttons are clicked. So if I click Button3 5 times, then Button7 3 times, putting them in order I should see 33333777 - even if I clicked 3 and 7 in a random order. </p>