w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Prolog program with lists

addDigit seems wrong to me: you use only the first, and leave the tail unspecified ! try

addDigit(NR,[DIGIT|Ns]):-
    NR>0,
    DIGIT = NR MOD 10,
    NR1 = NR DIV 10,
    addDigit(NR1, Ns).




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.