Skip to content

Instantly share code, notes, and snippets.

@vsalvati
Created October 24, 2012 18:24
Show Gist options
  • Save vsalvati/3947871 to your computer and use it in GitHub Desktop.
Save vsalvati/3947871 to your computer and use it in GitHub Desktop.
GCD in scala
package main.scala
object GCD
{
def gcd(a: Int,b: Int): Int = {
if(b ==0) a else gcd(b, a%b)
}
def main(args: Array[String]) {
println(gcd(25,15))
}
}
@yhm138
Copy link

yhm138 commented May 9, 2022

the efficience is low?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment