'FIxing fac.pl'
This commit is contained in:
parent
1f5ba69a6d
commit
028724325d
@ -32,3 +32,18 @@ parent(melsr,teo).
|
||||
|
||||
father(X,Y) :- male(X),parent(X,Y).
|
||||
mother(X,Y) :- female(X),parent(X,Y).
|
||||
son(X,Y) :- male(X),parent(Y,X).
|
||||
dauther(X,Y) :- female(X),parent(Y,X).
|
||||
uncle(X,Y) :- male(X),brother(X,Z),parent(Z,Y).
|
||||
aunt(X,Y) :- female(X),sister(X,Z),parent(Z,Y).
|
||||
|
||||
grandmother(X,Y) :- mother(Z,Y),mother(X,Z).
|
||||
grandmother(X,Y) :- father(Z,Y),mother(X,Z).
|
||||
|
||||
grandmother(X,Y) :- female(X),parent(Z,Y),parent(X,Z).
|
||||
|
||||
%grandfather
|
||||
sister(X,Y) :- female(X),parent(Z,X),parent(Z,Y),X\=Y.
|
||||
brother(X,Y) :- male(X),parent(Z,X),parent(Z,Y),X\=Y.
|
||||
cousin(X,Y) :- uncle(Z,Y),parent(Z,X).
|
||||
cousin(X,Y) :- aunt(Z,Y),parent(Z,X).
|
@ -5,6 +5,6 @@ fac(3,6).
|
||||
fac(4,24).
|
||||
fac(A,B) :-
|
||||
A > 0,
|
||||
fac(C,D),
|
||||
C is A-1,
|
||||
fac(C,D),
|
||||
B is A*D.
|
Loading…
Reference in New Issue
Block a user