How to calculate factorial using prolog | Prolog factorial recursion with sudo code | factorial program in prolog with output | Prolog program to Calculate factorial of N | factorial program in prolog using recursion


Prolog program to Calculate factorial of N:

fact(0,0).
fact(1,1).
fact(N,Result):- N>1,

N1 is N-1,
fact(N1,R1),
Result is N*R1.




output





Comments

Popular posts from this blog

How to solve an 8 puzzle problem using A* Algorithm in python

Timus Online Judge 1000. A+B Problem question and SOLVE with sudo code

URI Online Judge | 1013 The Greatest Solve with source code