Created
July 4, 2018 14:26
-
-
Save lpeppe/cbdbb4a2e9c2c39ef47d8f80d0606367 to your computer and use it in GitHub Desktop.
Greatest common divisor in scala
This file contains 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
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