Hi I have been having a problem working out how to get this to work. It's intended to find the first x number of prime numbers using a user input to set x. It will then place any in an array before printing the results. I think I have made an issue with the loops as once the user input is entered nothing will happen. I'd be grateful if anyone could maybe point out where I have gone wrong and provide suggestions on how to fix it. Thanks

```
static void Main(string[] args)
{
int max, i, count;
i = 0; // this is used to keep trck of how many primes have been added to the array
count = 0; // this is used to test each number
Console.WriteLine("This will work out the first x prime numbers with x being the number of prime numbers you want");
Console.WriteLine("Enter the number of prime numbers you want.");
max = Convert.ToInt32(Console.ReadLine());
int[] primes = new int[max];
while (i <= max)
{
while (count <= 9999)
{
if (count % 2 == 0 || count % 3 == 0 || count % 5 == 0 || count % 7 == 0 ) // tests if count number is a prime
{
if (count == 2 || count == 3 ||count == 5 ||count == 7 ) // ensures 2,3,5,7 are added to primes if neccesarry
{
primes[count] = count; //add to array
i++; // increments the count on the number of prime numbers
}
count ++; // increments the count
break;
}
else
{
primes[count] = count;
i++;
count ++;
}
}
}
Console.WriteLine("The first {0} prime numbers are ... ", max);
foreach(var item in primes)
{
Console.Write(item.ToString() + ", ");
}
}
```