I would like to ask the solution of the below programs in Prolog.
Unfortunatelly I have never use this language:

1. Summary of the elements in a list, and check that is divided or not
diveded with 3? For example, the input should be only a list, like [1, 2, 3]
--> and the sum of the element is diveded with 3, because 1+2+3=6, and 6/3=2
--> so the output should be true.

2. If the 7 is in a list, doubles it. For example: the input is only a list,
like --> [1,7,3,7,7], the outputs should be an another list, like:
[1,7,7,3,7,7,7,7].

3. If the 7 is in a list, change it for 2,7,2. For example: the input is a
list -->[1,7,2,1], the output should be also a list [1,2,7,2,2,1]

What is the program and how to test it with SWI-Prolog?
Thank you in anticipation!

-- 
View this message in context: 
http://old.nabble.com/prolog-program-solutions-tp33923928p33923928.html
Sent from the Gnu - Prolog - Users mailing list archive at Nabble.com.
_______________________________________________
Users-prolog mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/users-prolog

Reply via email to