To find Factorial of a number - Artificial Intelligence Lab file



AIM: To find Factorial of a number

domains
A=integer.

predicates
fact(A,A).

clauses
      fact(1,1).
     
      fact(X,Y):-
           X1=X-1,
           fact(X1,Y1),
           Y=X*Y1.

Output:


No comments:

Post a Comment