VILL- DEBANDI, AMTA, HOWRAH PIN-711410 Phone-9836357266
16. Write a Prolog program to implement GCD of two numbers.
gcd(X,0,X).
gcd(X,Y,Z):-
R is mod(X,Y),
gcd(Y,R,Z).
OUTPUT:
gcd(6,9,X).
X = 3
No comments:
Post a Comment