Skip to content

Instantly share code, notes, and snippets.

@codecademydev

codecademydev/Program.cs Secret

Created Nov 17, 2020
Embed
What would you like to do?
Codecademy export
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