Listing 17 A C-function that computes the greatest common divisor of two integers by Euclid's algorithm

int gcd(int x, int y)
{
   int rem;

   while (y != 0)
   {
      rem = x % y;
      x = y;
      y = rem;
   }
   return x;
}
/* End of File */