fork download
  1. % Given an input number:
  2.  
  3. factorial(0,1).
  4.  
  5. factorial(N,F) :-
  6. N>0,
  7. N1 is N-1,
  8. factorial(N1,F1),
  9. F is N * F1.
  10.  
  11. ?- 125.
Success #stdin #stdout 0.02s 6204KB
stdin
5
stdout
Standard output is empty