factorial(0,1):- !.factorial(X, Y):- X>0, X1 is X-1, factorial(X1, Z), Y is X*Z.
factorial(5,X).
GNU Prolog 1.3.1 By Daniel Diaz Copyright (C) 1999-2009 Daniel Diaz X = 120 yes
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!