TechKnowledge
Google Search
Saturday, October 24, 2015
PROLOG Code for GCD
gcd(A,B,G):- A=B, G is A.
gcd(A,B,G):- A>B, AB is A-B, gcd(AB,B,G).
gcd(A,B,G):- A<B, BA is B-A, gcd(A,BA,G).
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment