title: Counting the number of times a value appears in an array
body: <p>So what's a good, simple algorithm to create a loop in C# where every time a certain value appears in an array it adds 1 to a counter in another array?</p>
  
  <p>For example I have this:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  namespace ConsoleApplication22
  {
      class Program
      {
          const int SIZE = 12;
  
          static void Main(string[] args)
          {
              int[] numbers = new int[SIZE] {5, 5, 5, 7, 7, 7, 9, 7, 9, 9, 9, 1};
             string[] letters = new string[SIZE] { "m", "m", "s", "m", "s", "s", "s", "m", "s", "s", "s", "s" };
              int[] values = new int[SIZE] {15, 22, 67, 45, 12, 21, 24, 51, 90, 60, 50, 44};
              string[] status = new string[SIZE] { "f", "m", "f", "a", "m", "f", "f", "f", "m", "f", "m", "f" };
  
              int[] Count = new int[4];
              int x = 0;
              int i = 0;
  
              for (i = 0; i &lt; SIZE - 1; i++)
              {
                  if (numbers[i] &gt; 0 &amp;&amp; numbers[i] &lt; SIZE)
                  {
                      x = Count[i];
                      Count[x]++;
                  }
              }
  
              for (i = 0; i &lt; 4; i++)
              {
                  Console.WriteLine("{0}", Count[4]);
              }
          }
      }
  }
  </code></pre>
  
  <p>I am only counting the number of times 4 numbers appear in the numbers array.  Someone suggested I use the method in the first loop but it doesn't seem to be working and creates an error that the index is out of bounds in the array.  I want to display the number of times each of those numbers(5, 7,9 and 1) appear in 4 rows.</p>
  
  <p>EDIT: Without using LINQ or any other fancy thing like Dictionary or whatever.</p>