About
RSS

Bit Focus Blog


Leap Year Determination

Posted at 2012-01-10 12:31:39 | Updated at 2018-03-28 13:06:57

At Wikipedia we may see a straightforward way to tell whether a year is leap or not. Well here is a more "compact" way (pseudocode)
func is_leap_year(year)
    return (year MOD 4) XOR (year MOD 100) XOR (year MOD 400)
where MOD is modulo, and XOR is exclusive or.

Post tags:   Algorithm

Leave a comment:




Creative Commons License Your comment will be licensed under
CC-NC-ND 3.0


. Back to Bit Focus Blog
NijiPress - Copyright (C) Neuron Teckid @ Bit Focus
About this site