Skip to content

Instantly share code, notes, and snippets.

@lpeppe
Created July 4, 2018 14:26
Show Gist options
  • Save lpeppe/cbdbb4a2e9c2c39ef47d8f80d0606367 to your computer and use it in GitHub Desktop.
Save lpeppe/cbdbb4a2e9c2c39ef47d8f80d0606367 to your computer and use it in GitHub Desktop.
Greatest common divisor in scala
def gcd(a: Int, b: Int) =
if(b == 0) a
else gcd(b, a%b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment