Skip to content

Instantly share code, notes, and snippets.

@afishr
Last active September 17, 2018 05:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afishr/47cc77dc60193aaafe0bfcb90f80a273 to your computer and use it in GitHub Desktop.
Save afishr/47cc77dc60193aaafe0bfcb90f80a273 to your computer and use it in GitHub Desktop.
//GCD_LCM
int a1 = a,
b1 = b;
while (b1 != 0)
{
a1 %= b1;
swap(a1, b1);
}
int GCD = a1,
LCM = (a * b) / GCD;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment