title: console application where the user has 5 tries to guess number between 1 and 100
body: <p>I have created a console application where the user has 5 tries to guess number between 1 and 100. After 5 guesses the game ends, but I don’t know how to introduce at the 5th wrong intent something like “you have achieved maximum of guesses! The answer was number (X). I have tried different ways ,but is not working. This is my program</p>
  <pre>using System;
  
  namespace Guessing_Game_4
  {
      class Program
      {
          static void Main(string[] args)
          {
              var number = new Random().Next(1, 100);
              Console.WriteLine(&quot;Try and guess any number between 1-100. You have 5 guesses Max!&quot;);
  
              for (var i = 0; i &lt; 5; i++)
              {
                  int guess = Convert.ToInt32(Console.ReadLine());               
                  if (guess == number)
                  {
                      Console.WriteLine(&quot;You got it!&quot;);
                      break;
                  }
                  else
                  {
                      Console.WriteLine(guess + &quot; is not correct! Try again!&quot;);
                  }   
              }
          }
      }
  }
  </pre>