Prolog program to find the Factorial of a number Posted on March 16, 2011 by mahmud faisal Find the Factorial of a number predicates go fact(integer,integer) clauses go:- write("give the no:"), readint(X), Z=1, fact(X,Z). fact(1,Z):- write("the result:",Z). fact(X,Z):- Y=Z*X, XX=X-1, fact(XX,Y). Share this:FacebookTwitterLike this:Like Loading... Related

What about if we have the factorial of a number and we want to find in which number it belongs? For example i have 120 and want prolog to tell me that 120 is the factorial of 5. Reply

What about if we have the factorial of a number and we want to find in which number it belongs? For example i have 120 and want prolog to tell me that 120 is the factorial of 5.

thanks ^ ^