Home > Net >  While (input! Why the input q="q") or will enter the while loop
While (input! Why the input q="q") or will enter the while loop

Time:12-06

String input="";
While (input!="q")
{
Console. WriteLine (" please enter a number, we will print the number 2 times ");
Input=Console. ReadLine ();
If (input!="q")
{
Try
{
Int number=the Convert. ToInt32 (input);
Console. WriteLine (" the Numbers you entered twice is {0} ", number * 2);
}
Catch
{
Console. WriteLine (" you input string will not be able to convert number, please enter again ");
}
}
The else
{
Console. WriteLine (" you input is q, the program will exit ");
}
}
The Console. ReadKey ();
  •  Tags:  
  • C#
  • Related