Post Reply 
Leap Year Test
10-13-2017, 09:06 PM
Post: #7
RE: Leap Year Test
I'm not fluent in HPPPL and don't have my prime with me, so the following should be taken generically.

The leap year calculation is also a good example of using the XOR function. If a year is divisible by 4 then it's a leap year, but if divisible by 100 then it isn't, but if divisible by 400 then it is:

Code:
boolean isLeapYear = (year%4 == 0) XOR (year%100 == 0) XOR (year%400 == 0)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Leap Year Test - Eddie W. Shore - 10-13-2017, 01:36 AM
RE: Leap Year Test - Didier Lachieze - 10-13-2017, 03:06 AM
RE: Leap Year Test - chromos - 10-13-2017, 08:33 AM
RE: Leap Year Test - Didier Lachieze - 10-13-2017, 11:31 AM
RE: Leap Year Test - StephenG1CMZ - 10-13-2017, 06:37 PM
RE: Leap Year Test - chromos - 10-13-2017, 08:32 PM
RE: Leap Year Test - StephenG1CMZ - 10-13-2017, 10:35 PM
RE: Leap Year Test - David Hayden - 10-13-2017 09:06 PM
RE: Leap Year Test - ggauny@live.fr - 10-14-2017, 09:33 AM
RE: Leap Year Test - StephenG1CMZ - 10-15-2017, 07:45 PM



User(s) browsing this thread: 1 Guest(s)