PREDICATES
hcf(integer,integer,integer)
CLAUSES
hcf(X, Y, G) :- X = Y, G = X.
hcf(X, Y, G) :- X < Y, Y1= Y-X,
hcf(X, Y1, G).
hcf(X, Y, G) :- X > Y, hcf(Y, X, G).
GOAL
hcf(17,19,G).
hcf(integer,integer,integer)
CLAUSES
hcf(X, Y, G) :- X = Y, G = X.
hcf(X, Y, G) :- X < Y, Y1= Y-X,
hcf(X, Y1, G).
hcf(X, Y, G) :- X > Y, hcf(Y, X, G).
GOAL
hcf(17,19,G).
Comments
Post a Comment