Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace GuessTheNumberGame
- {
- class Program
- {
- static void Main(string[] args)
- {
- Random rnd = new Random();
- int randomNumber = rnd.Next(1, 10);
- Console.WriteLine("I'm thinking of a number 1-10. Can you guess it? ");
- for (int guess = Convert.ToInt32(Console.ReadLine()); guess != randomNumber; guess = Convert.ToInt32(Console.ReadLine()))
- {
- if (guess < randomNumber)
- {
- Console.WriteLine("To Low ");
- }
- if (guess > randomNumber)
- {
- Console.WriteLine("To High ");
- }
- }
- Console.WriteLine("Good job! You guessed the number right!");
- Console.ReadKey();
- }
- }
- }
Add Comment
Please, Sign In to add comment