int isLeap[int year) { return (year % 4 == 0) && (year % 100 != 0 || year % 400 == 0); }
All things relative to everyday programming and DBA practices, This blog will not give you the ET staff, just little remindings about how things work. Subjects are relative to databases, programming, Linux, Windows and ... you name it. I used to have a notepad onto which I put down anything I thought I might need again. Hopefully this is going to be as good as the paper with the added value of being able to paste from.
Monday, 5 February 2007
Boolean Expression to Determine if a Year is Leap
The following is a C function that determines if a year is leap. Comes in pretty handy and is easy to convert to other languages as well.
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment