Give a tail-recursive definition for each of the following predicates.
power(X,Y,Z): XY=Z.
gcd(X,Y,Z): The greatest common divisor of X and Y is Z.
sum(L,Sum): Sum is the sum of the elements in L.
Thank you very much and God bless your day
I justed started prolog and wanted some help on doing the following:
Express the following relations and queries in Prolog:
niece(X,Y): X is a niece of Y.
aunt(X,Y): X is an aunt of Y.
relative(X,Y): X and Y are relatives.
Who are joe's children?
How many children does joe have?
Are joe...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.