本文导语: c语言判断某一年是否为闰年的各种实现程序代码1、公历闰年计算原则(按一回归年365天5小时48分45.5秒)1)普通年能整除4且不能整除100的为闰年。(如2004年就是闰年,1900年不是闰年)2)世纪年能整除400的是闰年。(如2000年是闰年...
1、公历闰年计算原则(按一回归年365天5小时48分45.5秒)
1)普通年能整除4且不能整除100的为闰年。(如2004年就是闰年,1900年不是闰年)
2)世纪年能整除400的是闰年。(如2000年是闰年,1900年不是闰年)
3)对于数值很大的年份,这年如果能被3200整除,并且能被172800整除则是闰年。如172800年是闰年,86400年不是闰年(因为虽然能被3200整除,但不能被172800整除)(此按一回归年365天5h48‘45.5‘‘计算)。
if( ((0 == year%4)&&(0 != year%100)) ||(0 == year %400) )
{
//满足该条件的yeat就是闰年。
}
3、公历闰年程序代码(由www.169it.com搜集自互联网)
公历闰年实现代码一:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
公历闰年实现代码二:
1 2 3 4 5 6 7 8 9 10 |
|
公历闰年实现代码三:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
以上代码,仅供参考。
原文地址:https://www.cnblogs.com/w521w/p/9005928.html