Created
October 24, 2012 18:24
-
-
Save vsalvati/3947871 to your computer and use it in GitHub Desktop.
GCD 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
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)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment