Skip to content

Instantly share code, notes, and snippets.

@anishLearnsToCode
Created November 28, 2021 22:37
Show Gist options
  • Save anishLearnsToCode/229e338f5ee524339357b6e6f4227f32 to your computer and use it in GitHub Desktop.
Save anishLearnsToCode/229e338f5ee524339357b6e6f4227f32 to your computer and use it in GitHub Desktop.

Greatest Common Divisor (Euclid's Algorithm)

private static int gcd(int a, int b) {
    return b == 0 ? a : gcd(b, a % b);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment