执行出错
int year=0;Console.Write("please enter year:");
if(year>=100&&year<=9999)
{
if(year%400==0||(year%4==0&&year%100!=0))
{
Console.Write("{0}年是闰年",year);
}
else
{
Console.Write("{0}年不是闰年",year);
}
}
Console.ReadLine();
string year ;
Console.Write("please enter year:");
year=Console.ReadLine();
if (Convert.ToInt32(year)>= 100 && Convert.ToInt32(year) <= 9999)
{
if (Convert.ToInt32(year) % 400 == 0 || (Convert.ToInt32(year) % 4 == 0 && Convert.ToInt32(year) % 100 != 0))
{
Console.Write("{0}年是闰年", year);
}
else
{
Console.Write("{0}年不是闰年", year);
}
}
Console.Read();