📜  prolog 阶乘 - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:20.751000             🧑  作者: Mango

代码示例1
factorial(0, 1).
factorial(N, F) :- 
    N > 0, 
    Prev is N -1, 
    factorial(Prev, R), 
    F is R * N.