且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在C中以编程方式找到leap年

更新时间:2023-11-29 11:27:52

您确定a年的逻辑是错误的.这应该可以帮助您入门(来自Wikipedia):

Your logic to determine a leap year is wrong. This should get you started (from Wikipedia):

if year modulo 400 is 0
       then is_leap_year
else if year modulo 100 is 0
       then not_leap_year
else if year modulo 4 is 0
       then is_leap_year
else
       not_leap_year

x modulo y表示x的余数除以y.例如,以12为模5就是2.

x modulo y means the remainder of x divided by y. For example, 12 modulo 5 is 2.