Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Windows.Forms;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int x;
- Console.Write("Enter a number: ");
- x = Int32.Parse(Console.ReadLine());
- if (x == 2)
- {
- DialogResult ans;
- do
- {
- ans = MessageBox.Show("do you want to enter another number ?",
- "have you entered 2?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
- if (ans == DialogResult.Yes) Console.Clear();
- else Console.Write(x);
- }
- while (ans != DialogResult.Yes);
Advertisement
Add Comment
Please, Sign In to add comment