Monday, 18 March 2019

Simple Programming In Prolog 1

Below is an example of simple programming with a simple prolog Programming. Attention to rectangle (ABCD), AB = 10 cm, BC = 6cm. How long AC (diameter AC)? 

The answer is:

side_of_ABCD( ab, 10).
side_of_ABCD( bc, 6).

side_of_AC(AC):-side_of_ABCD( ab, AB),side_of_ABCD( bc, BC),
                              AC is sqrt((AB*AB)-(BC*BC)).

No comments:

Post a Comment

Note: only a member of this blog may post a comment.