Mathematica has a function that will decide if a number is an integer or not.

IntegerQ[Pi]

In class we translated the definition of a leap year into a logical statement involving the IntegerQ function. Now we can program that into Mathematica. We make it a Mathematica function which we call LeapQ.

LeapQ[y_] := 
      Or[And[IntegerQ[(y/4)], Not[IntegerQ[(y/100)]]], 
        IntegerQ[(y/400)]]

Next we test our function.

LeapQ[2014]

LeapQ[2016]

LeapQ[2100]

LeapQ[2000]