PREDICATES
factorial(integer, integer)
CLAUSES
factorial(0,1).
factorial(X,Y):-
X<>0, S=X-1, factorial(S,Y1), Y=X*Y1.
GOAL
write("The value of Z is "),
factorial(5,Z).
-->
PREDICATES
factorial(integer, integer)
CLAUSES
factorial(0,1).
factorial(X,Y):-
X<>0, S=X-1, factorial(S,Y1), Y=X*Y1.
GOAL
write("The value of Z is "),
factorial(5,Z).
تعليقات: 0
إرسال تعليق