Write Prolog program to A) find the sum of all items in a list. EXAMPLE (sum(S, [1,2,3,4]).==>
Fantastic news! We've Found the answer you've been seeking!
Question:
Write Prolog program to
A) find the sum of all items in a list. EXAMPLE (sum(S, [1,2,3,4]).==> S = 10 ) , (sum(S, []).==> S = 0)
B) sort all items in a list in descending order EXAMPLE ( sort(S,[1,3,2,1,5]).==> S = [5, 3, 2, 1, 1] )
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date: