using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace 判断闰年和大小月
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("(按一回归年365天5小时48分45.5秒)");
Console.WriteLine(" ①、普通年能整除4且不能整除100的为闰年。");
Console.WriteLine( " ②、世纪年能整除400的是闰年。");
Console.WriteLine(" ③、对于数值很大的年份,这年如果能被3200整除,并且能被172800整除则是闰年。");
Console.WriteLine("单月小,双月大。");
int yea, month;
Console.WriteLine("\n请输入年(XXXX)");
yea = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("请输入月(YY )");
month = Convert.ToInt32(Console.ReadLine());
if (yea>=0&&yea % 4 == 0 && yea % 100 != 0 || yea % 400 == 0 || yea % 3200 == 0 && yea % 17280 == 0)
{
Console.WriteLine("{0} 这年是闰年", yea);
}
else if (yea < 0)
{
Console.WriteLine("{0}?? 年份无效!", yea);
}
else { Console.WriteLine("{0} 这年不是闰年", yea); }
if (month > 0 && month <= 12)
{
if (month % 2 == 1)
{
Console.WriteLine("{0} 这月是大月", month);
}
else if (month % 2 == 0)
{
Console.WriteLine("{0} 这月是小月", month);
}
}
else Console.WriteLine("{0} ?? 月数无效!", month);
Console.ReadKey();
}
}
}
初学,有点臃肿,F5通过
