Breaking down leap year logic: A year is a leap year if divisible by . But years divisible by are NOT leap years. Except years divisible by ARE leap years.
So is a leap year (divisible by ). But is not (divisible by but not ). And is a leap year (divisible by , not by ).
The condition in code: (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0) Translation: divisible by but not , OR divisible by . The parentheses group the logic correctly.