title: Press Q to quit in c# without a Console.Read method?
body: <p>This is my first time on here and I'm also new to C# so bear with me.
  I was given a task to code a program that will print out the times tables up to 20 for a user input number, and keep asking for numbers and printing out the times tables until the user presses q to quit. </p>
  
  <p>I'm having trouble with breaking the loop and I'm not quite sure why. Here is the program so far:</p>
  
  <pre><code>        //variable declarations
          int number;
  
  
          //output title
          Console.WriteLine("Welcome to the 20 Times Tables Calculator");
  
          //output prompt for number
          Console.WriteLine("Please enter a number between 1 and 20 (inclusive).");
  
          //infinite loop
          for (; ; )
          {
  
  
              //input number
              number = int.Parse(Console.ReadLine());
              //validate number
              while (number &gt; 20)
              {
                  Console.WriteLine("Please enter a number smaller than 20.");
                  number = int.Parse(Console.ReadLine());
  
              }
  
              //calculate multiple x number
              //increment i
              //repeat until i = 20
              for (int i = 1; i &lt;= 20; i++)
              {
                  Console.WriteLine("\t" + i + " x " + number + " = " + i * number);
              }
              Console.WriteLine("\nEnter another number or press q to quit.");
  
              //break loop
              //press q to quit
              while (Console.ReadKey().KeyChar != 'q') ;
  
          }
  
           //retain console screen
          Console.ReadKey();
  </code></pre>
  
  <p>Any help is much appreciated!</p>