Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
The greatest common divisor can be calculated:
Code in plain text can be found here.
Using Euclid's algorithm.
int GreatestCommonDivisor(int x, int y) |
Using Euclid's algorithm, a recursive function:
int GreatestCommonDivisor(const int x, const int y) |
From http://www.boost.org/doc/html/boost_math/gcd_lcm.html:
#include <boost/math/common_factor.hpp> |
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.