#编码
Console.WriteLine("请输入年份:");
string str_year = Console.ReadLine(); //输入年份
int year = Convert.ToInt32(str_year); //类型转换
bool b = year % 400 == 0 || (year % 4 == 0 && year % 10 != 0); //判断是否
Console.WriteLine("是否正确:{0}",b);
Console.ReadKey();
#效果

网友评论