fac(0,1):-!.
fac(N,Nfac):-
N>0.
M is N -1.
fac(M, Mfac).
Nfac is N*Nfac.