This repository has been archived on 2023-04-18. You can view files and clone it, but cannot push or open issues or pull requests.
iaj/TP1/Prolog/AidesCPP/fac.pl

8 lines
No EOL
99 B
Prolog

fac(1,1):- !.
fac(X,F):-
X > 1,
Y is X - 1,
fac( Y, Next ),
F is X * Next.
% ?- fac(3, X).