- Any year evenly divisible by 400 is a leap year (e.g., 2000 was a leap year).
- Any other year evenly divisible by 100 is not a leap year (e.g., 1700, 1800 and 1900 were not leap years).
- Any other year evenly divisible by 4 is a leap year (e.g., 1996 and 2004 are leap years).
But I’m not sure how to make nested if states in my c-program that would produce the right answer…
Convert them both to UNIX epoch time and subtract the difference.
Once you’ve got the number of seconds, you divide that difference by the number of seconds in a day (which is 24 hours * 60 minutes * 60 seconds = 86400 seconds).