会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
HAPPYCODEING LOVESHARING
Copy要看质量,自己感不感兴趣
Paste要能理解,自己能不能掌握
与君共勉
博客园
首页
新随笔
联系
订阅
管理
找出闰年
using
System;
using
System.Collections.Generic;
using
System.Text;
namespace
ConsoleApplication1
{
class
Program
{
static
void
Main(
string
[] args)
{
List
<
int
>
leap1
=
new
List
<
int
>
();
List
<
int
>
leap2
=
new
List
<
int
>
();
for
(
int
year
=
1900
;year
<=
9999
;year
++
)
{
if
(year
%
4
==
0
&&
year
%
100
!=
0
)
{
leap1.Add(year);
}
else
if
(year
%
100
==
0
&&
year
%
400
==
0
)
{
leap2.Add(year);
}
}
Console.WriteLine(
"
被4整除的闰年
"
);
foreach
(
int
temp
in
leap1)
{
Console.WriteLine(temp);
}
Console.WriteLine(
"
被400整除的闰年
"
);
foreach
(
int
temp
in
leap2)
{
Console.WriteLine(temp);
}
Console.Read();
}
}
}
posted on
2008-04-10 13:16
josephshi
阅读(
233
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部