A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
10
Task/Leap-year/Prolog/leap-year-1.pro
Normal file
10
Task/Leap-year/Prolog/leap-year-1.pro
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
leap_year(L) :-
|
||||
partition(is_leap_year, L, LIn, LOut),
|
||||
format('leap years : ~w~n', [LIn]),
|
||||
format('not leap years : ~w~n', [LOut]).
|
||||
|
||||
is_leap_year(Year) :-
|
||||
R4 is Year mod 4,
|
||||
R100 is Year mod 100,
|
||||
R400 is Year mod 400,
|
||||
( (R4 = 0, R100 \= 0); R400 = 0).
|
||||
4
Task/Leap-year/Prolog/leap-year-2.pro
Normal file
4
Task/Leap-year/Prolog/leap-year-2.pro
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
?- leap_year([1900,1994,1996,1997,2000 ]).
|
||||
leap years : [1996,2000]
|
||||
not leap years : [1900,1994,1997]
|
||||
L = [1900,1994,1996,1997,2000].
|
||||
Loading…
Add table
Add a link
Reference in a new issue