Featured Post

Step Wise Project Planning

Planning is the most difficult process in project management. The framework described is called the Stepwise method to help to distinguis...

  1. Home

WAP to compute GCD of two number.

 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
Previous
Next Post »