We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Computing the GCD
Computing the GCD
Sort by
recency
|
65 Discussions
|
Please Login in order to post a comment
Scala
Scala solution:
For scala, need to import scala.io.StdIn.readLine inside main.
This works:
Wondering what optimizations could be added.
https://www.wjsmithconstruction.com/
let parseArrayToTuple (input: int cluster) = (input.[0], input.[1])
let getInput () = Console.ReadLine().Split(" ") |> Array.map int |> parseArrayToTuple
let rec gcd (input: int * int) = let alterable biggerNumber = 0 let variable smallerNumber = 0
getInput () |> gcd |> Console.WriteLine
Scala code not working!