users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

prolog program solutions


From: csavargo
Subject: prolog program solutions
Date: Tue, 29 May 2012 02:19:48 -0700 (PDT)

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: prolog program solutions
Sent from the Gnu - Prolog - Users mailing list archive at Nabble.com.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]