Guest User

Untitled

a guest
Dec 9th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace GuessTheNumberGame
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11.  
  12. Random rnd = new Random();
  13. int randomNumber = rnd.Next(1, 10);
  14. Console.WriteLine("I'm thinking of a number 1-10. Can you guess it? ");
  15. for (int guess = Convert.ToInt32(Console.ReadLine()); guess != randomNumber; guess = Convert.ToInt32(Console.ReadLine()))
  16. {
  17. if (guess < randomNumber)
  18. {
  19. Console.WriteLine("To Low ");
  20. }
  21. if (guess > randomNumber)
  22. {
  23. Console.WriteLine("To High ");
  24. }
  25. }
  26. Console.WriteLine("Good job! You guessed the number right!");
  27. Console.ReadKey();
  28. }
  29. }
  30. }
Add Comment
Please, Sign In to add comment