VasilM

Untitled

Apr 6th, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. using System.Windows.Forms;
  2.  
  3.  
  4. namespace ConsoleApplication1
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int x;
  11.             Console.Write("Enter a number: ");
  12.             x = Int32.Parse(Console.ReadLine());
  13.             if (x == 2)
  14.             {
  15.                 DialogResult ans;
  16.                 do
  17.                 {
  18.                     ans = MessageBox.Show("do you want to enter another number ?",
  19.                         "have you entered 2?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
  20.                     if (ans == DialogResult.Yes) Console.Clear();
  21.                     else Console.Write(x);
  22.                 }
  23.                 while (ans != DialogResult.Yes);
Advertisement
Add Comment
Please, Sign In to add comment