Skip to content

Instantly share code, notes, and snippets.

@sailfish009
Created April 17, 2019 02:03
Show Gist options
  • Save sailfish009/009e8685b3f9effe8a3b1ac51ad4dd06 to your computer and use it in GitHub Desktop.
Save sailfish009/009e8685b3f9effe8a3b1ac51ad4dd06 to your computer and use it in GitHub Desktop.
// https://stackoverflow.com/questions/10956543/gcd-function-in-c-sans-cmath-library
template <typename Number>
Number GCD(Number u, Number v)
{
while (v != 0)
{
Number r = u % v;
u = v;
v = r;
}
return u;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment