leap_year(X):- number(X), 0 is X mod 4.

days_in_year(X,366) :- leap_year(X),!.
days_in_year(_,365).
