标题:执行出错
只看楼主
feidao_779
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2006-10-1
 问题点数:0 回复次数:1 
执行出错
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();
搜索更多相关主题的帖子: please 
2006-10-03 13:48
konggs
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2006-9-1
得分:0 

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();

2006-10-03 14:18



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-94063-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.147832 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved