In previous article we have discussed about Prolog and how to make program in Prolog.
In the factorial program like take 5
- Factorial of 5 is 120 as 5*4*3*2*1
PROGRAM:
fact(1,1). fact(N,R):- N1 is N-1, fact(N1,R1), R is R1*N.
OUTPUT:
In previous article we have discussed about Prolog and how to make program in Prolog.
In the factorial program like take 5
PROGRAM:
fact(1,1). fact(N,R):- N1 is N-1, fact(N1,R1), R is R1*N.
OUTPUT: