-
-
Save codecademydev/24d7bc04e5290b580f43d362cc54d6e0 to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Review | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
//Number Guessing game from 1 -10 | |
var rand = new Random(); | |
int guess = rand.Next(1, 10); | |
Console.WriteLine("Guess number betweem 1-10: "); | |
double userNumber = Convert.ToDouble(Console.ReadLine()); | |
if(userNumber == guess){ | |
Console.WriteLine("You guessed correctly"); | |
} else if(userNumber > guess){ | |
Console.WriteLine("You guessed higher number"); | |
} else if(userNumber < guess){ | |
Console.WriteLine("You guessed lower number"); | |
} else{ | |
Console.WriteLine("Guess Again"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment