home *** CD-ROM | disk | FTP | other *** search
/ Microsoftware Monthly 19…2 Programming Power Tools / MASO9512.ISO / cpptutor / cpptutor.arj / CH10 / A10225.TXT < prev    next >
Encoding:
Text File  |  1993-09-24  |  399 b   |  7 lines

  1. The function gcd() finds the greatest common divisor (or g.c.d.)
  2. of its two arguments.  Since it is recursive, this function cannot
  3. be an inline function.  The algorithm used here is based on two
  4. facts.  The first is that the g.c.d.  of any positive integer and
  5. 0 is the positive integer.  The second is that the g.c.d of any
  6. two positive integers x and y equals the g.c.d.  of y and x mod y.
  7.