1、
Console.WriteLine("请您输入一个数字:");
int i = int.Parse(Console.ReadLine());
if(i>=21)
Console.WriteLine(i);
else
continue;
2、Console.WriteLine("请输入要查找的文字");
string inputstr = Console.ReadLind();
string[] mystr = new string[3];
mystr[0] = "星期一";
mystr[1] = "星期二";
mystr[2] = "星期三";
for(int i = 0;i<mystr.Length;i++)
{
if(mystr[i].Equals(inputstr))
{
goto Found;
}
}
Console.WriteLine("您查找的{0}不存在!",inputstr);
goto Finish;
Found:
Console.WriteLine("您查找的{0}存在!",inputstr);
Finish:
Console.WriteLine("查找完毕!");
Console.ReadLine();
3、Console.WriteLine("请您输入一个整数");
int MyInteger = int.Parse(Console.ReadLine());
int MyInteger;
string MyWeek;
switch(MyInteger){
case 1: MyWeek = "您输入的整数属于周一!";break;
case 2: MyWeek = "您输入的整数属于周二!";break;
case 3: MyWeek = "您输入的整数属于周三!";break;
case 4: MyWeek = "您输入的整数属于周四!";break;
case 5: MyWeek = "您输入的整数属于周五!";break;
case 6: MyWeek = "您输入的整数属于周六!";break;
case 7: MyWeek = "您输入的整数属于周日!";break;
default:
MyWeek = "数字输入错误!";break;}Console.WriteLine(MyWeek);}