Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 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].
|
||||
2
Task/Leap-year/Prolog/leap-year-3.pro
Normal file
2
Task/Leap-year/Prolog/leap-year-3.pro
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
?- findall(Y, (between(1990,2030,Y),day_of_the_year(date(Y,12,31),366)), L).
|
||||
L = [1992, 1996, 2000, 2004, 2008, 2012, 2016, 2020, 2024, 2028].
|
||||
Loading…
Add table
Add a link
Reference in a new issue