% Write a Prolog program to implement sumlist(List,Sum) so that Sum is the sum of
% a given list of numbers List.
/* Sum of the numbers from the list. */
sumlist([],0).
sumlist([H|T],R):-
sumlist(T,R1),
R is H+R1.
% Output
 |
Prolog Program to find the sum of numbers in the list. |
No comments:
Post a Comment