WAP to compute GCD of two number.
predicates
gcd(integer,integer,integer)
clauses
gcd(M,N,O)
if
N>0,M>0,O=M mod N.
gcd(M,N,Result)
if
N>0,
M>0,
M>=N,
Rem=M
mod N,).
gcd(N,Rem,Result
Output:-
Goal:gcd(4,12,A)
A=4
1 Solution