Menu

[Solved]8 Write Facts Rules Compute Sum First N Numbers Example Sum 3 X Sum 5 X X 15 Sum 7 X X Q37243773

Please code the following in Prolog. Thanks.

8. Write the facts and rules, that compute the sum of the first n numbers. For example, ?- sum (3, X). ?- sum (5, x). x=15 ?-

8. Write the facts and rules, that compute the sum of the first n numbers. For example, ?- sum (3, X). ?- sum (5, x). x=15 ?- sum (7,X). X-28 Show transcribed image text 8. Write the facts and rules, that compute the sum of the first n numbers. For example, ?- sum (3, X). ?- sum (5, x). x=15 ?- sum (7,X). X-28

Expert Answer


Answer to 8. Write the facts and rules, that compute the sum of the first n numbers. For example, ?- sum (3, X). ?- sum (5, x). x=… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *