Created
April 17, 2019 02:03
-
-
Save sailfish009/009e8685b3f9effe8a3b1ac51ad4dd06 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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