wmi-parprog/06_prolog/fac.pl

10 lines
146 B
Perl
Raw Normal View History

2024-04-15 13:40:54 +02:00
fac(0,1).
fac(1,1).
fac(2,2).
fac(3,6).
fac(4,24).
fac(A,B) :-
A > 0,
C is A-1,
2024-04-18 12:32:57 +02:00
fac(C,D),
2024-04-15 13:40:54 +02:00
B is A*D.