public static void Main()
Random rand = new Random(); int randomCode = rand.Next(10, 99);
int setRandomCode = randomCode;
string randCodeString = Convert.ToString(setRandomCode); char[] randCodeChar = randCodeString.ToCharArray();
Console.WriteLine("You have 10 turns to guess the code.");
string guess = Console.ReadLine(); char[] guessChar = guess.ToCharArray();
if (guessChar[0] == randCodeChar[0])
Console.WriteLine("Your first digit is in the correct place.");
guessesLeft = guessesLeft - 1;
guess = Console.ReadLine();
else if (guessChar[1] == randCodeChar[1])
Console.WriteLine("Your second digit is in the correct place.");
guessesLeft = guessesLeft - 1;
guess = Console.ReadLine();
else if ((guessChar[0] == randCodeChar[0]) && (guessChar[1] == randCodeChar[1]))
Console.WriteLine("You have no digits in the correct place.");
guessesLeft = guessesLeft - 1;
guess = Console.ReadLine();
if ((guessChar[0] == randCodeChar[0]) && (guessChar[1] == randCodeChar[1]))
Console.WriteLine("You have guessed the code correctly!");
Console.WriteLine("You did not guess the code correctly. \n Please rerun the program to try again with a new code.");