title: Program will exit the loop even if wrong input
body: <p>I'm a beginner and learning C#.</p>
  
  <p>I'm trying to do my homework, but got stuck. My program will exit the loop even if I type wrong input.</p>
  
  <p>This is my code:</p>
  
  <pre><code>public class Program
  {
      private static void Main(string[] args)
      {
          int lastYear = 0, thisYear = 0, totalRev;
  
          while (lastYear &gt;= 0 &amp;&amp; lastYear &lt;= 30)
          {
              WriteLine("Enter number contestants last year &gt;&gt; ");
              lastYear = int.Parse(ReadLine());
              lastYear++;
          }
  
          WriteLine("Number must be between 0 and 30");
          WriteLine("Enter number contestants last year &gt;&gt; ");
  
          while (thisYear &gt;= 0 &amp;&amp; thisYear &lt;= 30)
          {
              WriteLine("Enter num contestants this year &gt;&gt; ");
              thisYear = int.Parse(ReadLine());
          }
  
          WriteLine("Number must be between 0 and 30");
  
          totalRev = thisYear * 25;
          WriteLine($"last year's competition has {lastYear} conts, and this year's has {thisYear} conts " +
              "\nRevnue expected this year is {totalRev.ToString("c")} ");
  
          if (thisYear &gt; lastYear &amp;&amp; thisYear &lt;= (lastYear * 2))
              WriteLine("The competition is bigger than ever!");
          else if (thisYear &lt; lastYear)
              WriteLine("A tighter race this year! Come out and cast our vote!!");
          else if (thisYear &gt; lastYear * 2)
              WriteLine("The competition is more than twice as big this year!");
      }
  }
  </code></pre>