title: Getting user input, ingredient and price and return the cheapest and most expensive one
body: <p>I am completely new to C# and have encountered a problem that I can't find a solution for.</p>
  
  <p>The task is to write down three ingredients for a dish and then give the prices for them. Then the program is to find the cheapest and most expensive ingredients and return a message saying: </p>
  
  <p>"You've selected <em>first ingredient</em> and it cost <em>cheapest price</em>"</p>
  
  <p>"You've selected <em>second ingredient</em> and it cost <em>most expensive price</em>"</p>
  
  <p>The code I've written below only shows the price without the related ingredient.. Does anyone know how to solve this? </p>
  
  <p>Thank you for your time!</p>
  
  <pre><code>    static void Main(string[] args)
      {
  
          int counter = 0;
          int price = 0;
          int largest = 0;
          int lowest = 0;
          string ingredient;
  
          for (counter = 0; counter &lt; 3; counter++)
          {
              Console.WriteLine("Please select an ingredient");
              ingredient = Console.ReadLine();
          }
  
          for (counter = 0; counter &lt; 3; counter++)
          {
  
  
              Console.WriteLine("What is the price for it?");
              price = Convert.ToInt32(Console.ReadLine());
  
              if (counter == 0)
              {
                  largest = price;
              }
              else
              {
                  if (price &gt; largest)
                      largest = price;
              }
  
              if (counter == 0)
              {
                  lowest = price;
              }
              else
              {
                  if (price &lt; lowest)
                      lowest = price;
              }
          }
          Console.WriteLine("The most expensive ingredient costs {0} $", largest);
          Console.WriteLine("The cheapest ingredient costs {0} $", lowest);
          Console.ReadLine();
      }
  }
  </code></pre>
  
  <p>}</p>