PROLOG Program to Find GCD of Two Numbers

predicates
gcd(integer, integer, integer)
clauses
gcd(M, O, M).
gcd(M, N, Result):-
Rem=M mod N,
gcd(N, Rem, Result).

Output:
goals:
gcd(6, 4, Result)
Result=2