Code:
```using System;
using System.Collections.Generic;
using System.Text;

namespace _._
{
class Program
{
static void Main(string[] args)
{
while (true)
{
int randomNumber = GenerateNumber(1, 21);
int counter = 1;
while (true)
{
Console.Write("Enter a number between 1 and 20(0 to quit):");

if (input == 0)
return;
else if (input < randomNumber)
{
Console.WriteLine("Too low, try again.");
++counter;
continue;
}
else if (input > randomNumber)
{
Console.WriteLine("Too high, try again.");
++counter;
continue;
}
else
{
Console.WriteLine("You guessed it! The number was {0}!", randomNumber);
if (counter == 1)
Console.WriteLine("And you guessed it right away! Bonus points!\n");
else
Console.WriteLine("It took you {0} {1}.\n", counter, counter == 1 ? "try" : "tries");
break;
}
}
}

}
static int GenerateNumber(int min, int max)
{
Random random = new Random();
return random.Next(min, max);
}
}
}```
This code is for a guessing game, the user inputs a number and the computer states if its right or wrong

no I got the basics but I need to do more, I need an option to ask the user how many games he wants, and to only allow the user 6 tries before he or she loses, also I need the numbers in the range to get smaller and smaller after each guess

im so stuck on this, any help would be great
I tried
Code:
```if (counter == 6)
Console.WriteLine("You have attempted 6 times, you lost");
break;```
and that didnt work

also tried
Code:
```int guess = 0;
for( guess = 0; guess < 6; guess++ )
{
.
.
.
if( input == random )
break;
}
if( guess < 6 )
Console.WriteLine("It took you {0} {1}.\n", guess+1, (guess + 1) == 1 ? "try" : "tries");
else
Console.WriteLine("You lost.");```
and that didnt work either