Prolog program to Calculate factorial of N

We know the formula for calculating n! (factorial of n)  is: n! = n * (n-1)! We can interpret this simple mathematical equation into a Prolog program. To do so, we must determine the basis of the recursion, 0! = 1 We will use two predicates here, factorial predicate with one argument N, that will … Continue reading Prolog program to Calculate factorial of N