title: C# Using iteration to calculate the lowest value in a two dimensional array
body: <p>I just started my first C# programming class (no programming experience at all) and I have to ask the user to enter in 5 days and the amount of rainfall on each of those days and store the data in a two dimensional string array named rainfallData. I then need to find the sum, average, lowest, and highest values entered all using iteration. The sum and average I have figured out, but I cannot figure out how to find the lowest and values. I know how to find the lowest and highest values in a one dimensional array but cannot figure out the iteration needed to find it in a multidimensional array.</p>
  
  <pre><code>string[,] rainfallData = new string[5, 2];
  
  Console.Write("\nPlease enter a day of the week: ");
  rainfallData[0, 0] = Console.ReadLine();
  
  Console.Write("\nHow many inches of rain did you get on {0}: ", rainfallData[0, 0]);
  rainfallData[0, 1] = Console.ReadLine();
  
  Console.Write("\n\nPlease enter the next day of the week: ");
  rainfallData[1, 0] = Console.ReadLine();
  
  Console.Write("\nHow many inches of rain did you get on {0}: ", rainfallData[1, 0]);
  rainfallData[1, 1] = Console.ReadLine();
  
  Console.Write("\n\nPlease enter the next day of the week: ");
  rainfallData[2, 0] = Console.ReadLine();
  
  Console.Write("\nHow many inches of rain did you get on {0}: ", rainfallData[2, 0]);
  rainfallData[2, 1] = Console.ReadLine();
  
  Console.Write("\n\nPlease enter the next day of the week: ");
  rainfallData[3, 0] = Console.ReadLine();
  
  Console.Write("\nHow many inches of rain did you get on {0}: ", rainfallData[3, 0]);
  rainfallData[3, 1] = Console.ReadLine();
  
  Console.Write("\n\nPlease enter the next day of the week: ");
  rainfallData[4, 0] = Console.ReadLine();
  
  Console.Write("\nHow many inches of rain did you get on {0}: ", rainfallData[4, 0]);
  rainfallData[4, 1] = Console.ReadLine();
  
  double myMin2 = Convert.ToDouble(rainfallData[0, 1]);
  for (int i = 0; i &lt; rainfallData.GetLength(0); i++)
  {
     foreach (double element in rainfallData[i, 1])
       {
       if (element &lt; myMin2)
       {
         myMin2 = element;
       }
       }
  }
  Console.WriteLine("The day with the lowest amount of rainfall received {0}\" of rain.\n", myMin2);
  </code></pre>
  
  <p>No matter what values are entered for the rainfall, myMin2 is always the value of rainfallData[0,1]. I understand that this is because I set myMin2 = Convert.ToDouble(rainfallData[0, 1] however this same format worked when finding the lowest value of a one-dimensional array earlier in the code. The loops are throwing me for a loop and I have been stuck on this one section for 3 hours now. I wanted to find the answer on my own, but I am afraid unable to see the forest for the trees at this point and I am wasting valuable time which I am now out of.</p>
  
  <p>PS - I did my best to post everything correctly, but this is my first time posting on this site and I don't know all of the rules yet. I'm sorry if I did it incorrectly.</p>