• + 0 comments

    Scala solution:

    def gcd(x: Int, y: Int): Int = {
    	    val dev = Math.max(x - y, y -x)
          if (dev == 0) x else gcd(Math.max(dev,y), Math.min(dev,y))
       }