Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.Write("Enter your name ");
- String Name;
- Name = Console.ReadLine();
- Console.WriteLine("Guess the secret number," + Name + "");
- Random Rnd = new Random();
- ReturnPoint2: // I'll come back to this one later
- int secretnum = secretnum = Rnd.Next(1, 100);
- Console.WriteLine("<<psssst...the number is "+secretnum+">>");
- ReturnPoint:
- int guessnum = int.Parse(Console.ReadLine());
- if (guessnum > secretnum)
- { Console.Write("Too high."); }
- else if (guessnum < secretnum)
- { Console.Write("Too low."); }
- else
- { Console.Write("\nCongratulations," + Name + " You guessed correctly!"); }
- while (guessnum != secretnum)
- {
- Console.WriteLine(" Try again");
- goto ReturnPoint;
- }
- Console.WriteLine("\n \n \t Try Again? Yes or No \n");
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement