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

URI Online Judge | 1013 The Greatest Solve with source code

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

URI Online Judge | 1020 Age in Days Solve with source code