Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Created by SharpDevelop.
- * User: cpe
- * Date: 1/17/2017
- * Time: 9:19 AM
- *
- * To change this template use Tools | Options | Coding | Edit Standard Headers.
- */
- using System;
- namespace sawasdee
- {
- class Program
- {
- public static void Main(string[] args)
- {
- Random r = new Random();
- int answer = 1 + (r.Next() % 100);
- int g;
- int c = 0;
- do {
- c++;
- Console.Write("Guess a number: ");
- g = int.Parse(Console.ReadLine());
- if(g>answer)
- Console.WriteLine("Too Large");
- else if(g<answer)
- Console.WriteLine("Too Small");
- } while(g!=answer);
- Console.WriteLine("That's correct");
- Console.WriteLine("Counter: {0}",c);
- Console.Write("Press any key to continue . . . ");
- Console.ReadKey(true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement