fac(0, 1):-!.fac(N, Nfac):- N>0. M is N-1. fac(M, Mfac). Nfac is N*Mfac.
?-fac(5,X)
prog.pl:2-3: warning: singleton variables [Nfac] for fac/2 prog.pl:4: fatal error: redefining built-in predicate (is)/2 compilation failed
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!