static void Main(string[] args)
{
// if条件 1,判断年月日输入是否正确
Console.Write("请输入年分");
int a = Convert.ToInt32(Console.ReadLine());
Console.Write("请输入月分");
int b = Convert.ToInt32(Console.ReadLine());
Console.Write("日");
int f = Convert.ToInt32(Console.ReadLine());
if (a >= 0 && a <= 9999)
{
Console.WriteLine("年输入正确");
}
else
{
Console.WriteLine("谢谢惠顾");
}
if (b >= 1 && b <= 12)
{
Console.WriteLine("月输入正确");
}
else
{
Console.WriteLine("输入有误");
}
if (b == 1 || b == 3 || b == 5 || b == 7 || b == 8 || b == 10 || b == 12)
{
{
if (c > 0 && c <= 31)
{
Console.WriteLine("日输入正确 谢谢光临");
}
else
{
Console.WriteLine("输入有误");
}
}
}
if (b == 4 || b == 6 || b == 9 || b == 11)
{
if (c > 0 && c <= 30)
{
Console.WriteLine("谢谢光临");
}
else
{
Console.WriteLine("输入有误");
}
}
if (b == 2)
{
if (a % 400 == 0 || a % 4 == 0 && a % 100 != 0)
{
Console.WriteLine("是闰年");
if (c > 0 && c <= 29)
{
Console.WriteLine("欢迎来到闰年二月");
}
else
{
Console.WriteLine("输入有误");
}
}
else
{
Console.WriteLine("是平年");
if (c > 0 && c <= 28)
{
Console.WriteLine("欢迎来到平年二月");
}
else{Console.WriteLine("输入有误");
}
}Console.ReadLine();
}
//判断是否是一元二次方程
if (a == 0)
{
Console.WriteLine("回家反省 笨蛋!不是一元二次方程比个毛线");
}
else
{ Console.WriteLine("是一元二次方程"); }
//判断一元二次方程根的情况
//定义判断式
int d = b * b - 4 * a * c;
if(d!=0)
{
Console.WriteLine("方程有两个实根");
}
else if (d > 0)
{
Console.WriteLine("方程有一个实根");
}
else
{
Console.WriteLine("笨蛋呀,,方程都没有实数根你还算个毛啊,回家补课去吧");
}
Console.ReadLine();
//for循环 1,99乘法表
for (int i = 1; i <= 9; i++)
{
for (int j = 1; j <= i;j++ )
{
Console.Write(j+"*"+i+"="+j*i+"\t"); //\t空格
}
Console.WriteLine(""); //换行
}
Console.ReadLine();
//2,打印两个三角形 直角三角形
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= i;j++ )
{
Console.Write("*");
}
Console.WriteLine();
}
//到直角三角形
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <=6-i;j++ )
{
Console.Write(".");
}
Console.WriteLine();
}
原文:http://www.cnblogs.com/ROCKyou/p/4876504.html