title: C# increment an Int in an array based on index in another array
body: <p>This question is about a homework problem with C# programming. The goal of the program is the have an array of 20 integers between 0 - 9 and then have another 20 item array that increments (by one) at the index in which the first number 7 appears in the first array. In the code below I have an array called 'values' that generates the random numbers. The second array called 'sevens' has 20 zeros that could be incremented by one if the first 7 in the values array is found at the corresponding index. My issue is that I can't get the second array to increment. The values array correctly generates the numbers, but the sevens array remains all zeros. Any suggestions on how to get the index of 'sevens' to increment were the first 7 is found in 'values'?  </p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          int[] values = new int[20];
          int[] sevens = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
          0, 0, 0, 0, 0, 0 };
  
          Random random = new Random();
          int randValue;
          int count = 0;
  
          //Fills values with random integers between 0-9
          while (count &lt; values.Length)
          {
              randValue = random.Next(10);
              values[count] = randValue;
              count++;
          }
  
          //Displays the contents of values
          int valuesDisplayCount = 0;
          while (valuesDisplayCount &lt; values.Length)
          {
              Console.WriteLine("Array position {0} is {1}", valuesDisplayCount + 1, values[valuesDisplayCount]);
              valuesDisplayCount++;
          }
  
          while (valuesDisplayCount &lt; values.Length)
          {
              if(values[valuesDisplayCount] == 7)
              {
                  sevens[valuesDisplayCount]++;
                  break;
              }
              valuesDisplayCount++;
          }
  
          //Displays the contents of sevens
          int sevensDisplayCount = 0;
          while (sevensDisplayCount &lt; sevens.Length)
          {
              Console.WriteLine("Number of 7s at position {0}: {1} ", sevensDisplayCount + 1, sevens[sevensDisplayCount]);
              sevensDisplayCount++;
          }
          Console.ReadLine();
      }
  }
  </code></pre>