Created
December 20, 2012 15:09
-
-
Save FabienArcellier/4345818 to your computer and use it in GitHub Desktop.
Calculate a factoriel using prolog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fact(0,1). | |
fact(1,1). | |
fact(X, Result):- X > 1, X1 is X-1, fact(X1, Result1), Result is Result1 * X. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment