Guess a Number Console App

[code lang=”csharp”] using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
/*
Mark Hesser
October 17, 2017
Guess a Number Console
*/
namespace GuessConsole
{
class Program
{
static void Main(string[] args)
{
Console.Title = "Guess a Number";

// Declarations
Random rnd = new Random();
int randNum = rnd.Next(1, 100), guess, prevGuess = randNum, numTrys = 10;
bool guessCorrect = false, playAgain = true;
string temp, Yes_or_No;

// Main Game Loop
while (playAgain)
{
Console.WriteLine("I’m thinking of a number between 1 and 100");
Console.WriteLine("What is it? You have 10 Trys.");
// Debug Code Start
// Console.WriteLine("Debug {0}", randNum);
// Debug Code End

// Number input loop
while (!guessCorrect)
{
// Player gets 10 trys
if (numTrys > 0)
{
Console.WriteLine();
Console.Write("{0}. Guess: ", numTrys);
temp = Console.ReadLine();

// Checks to see if player entered a number
while (!Int32.TryParse(temp, out guess))
{
Console.WriteLine("oops, enter a number");
Console.Write("{0}. Guess: : ", numTrys);
temp = Console.ReadLine();
}
// First checks if player wins
if (guess == randNum)
{
guessCorrect = true; // ends input loop
numTrys = 10; // resets Trys
Console.Clear();
Console.WriteLine("That is correct! The number is {0}, You Win!", randNum);
}
else
{
if (guess != prevGuess) // Checks to see if player entered the same number twice
{
if (guess > 0 && guess < 101) // Checks to see if Guess is within range
{
if (guess < randNum) // Check to see if guess is less than number
{
Console.WriteLine("Try Again, Guess Higher!");
prevGuess = guess;
numTrys–;

}
else // if not less, then number is greater
{
Console.WriteLine("Try Again, Guess Lower!");
prevGuess = guess;
numTrys–;
}
}
else // Guess is not in range
{
Console.WriteLine("oops, enter a number between 1 and 100");
prevGuess = guess;
numTrys–;
}
}
else
{
Console.WriteLine("You just Guessed that, enter a different number");
}
}
}
else
{
Console.Clear();
Console.WriteLine("You are out of Trys, You Lose");
Console.WriteLine("The number was {0}", randNum);
guessCorrect = true;
}
}
Console.WriteLine();
Console.Write("Would you like to play again? (yes or no): ");
Yes_or_No = Console.ReadLine();

if (Yes_or_No == "yes")
{
playAgain = true;
numTrys = 10;
guessCorrect = false;
randNum = rnd.Next(1, 100);
Console.Clear();
}
else
{
playAgain = false;
}
}
}
}
}

[/code]