Horje
Write a prolog program to find the sum of elements in given list. Code Example
[Solved] - Write a prolog program to find the sum of elements in given list. Code Example
Try following codes
Write a prolog program to find the sum of elements in given list.
domains
    x = integer
    l = integer*
predicates
    sum(l,x)
clauses
    sum([],0).
    sum([X|List],Sum) :-
        sum(List,Sum1),
        Sum = X + Sum1.
Date: 2022-05-21 05:02:10
Category: typescript
More for You