You are viewing a single comment's thread. Return to all comments →
Elixir
defmodule Solution do def gcd(a,0), do: IO.puts(a) def gcd(a,b) when a > 0 do gcd(b, rem(a,b)) end end input = String.split(IO.gets("")," ") [a,b] = input |> Enum.map(fn(x) -> elem(Integer.parse(x),0) end) Solution.gcd(a,b)
Seems like cookies are disabled on this browser, please enable them to open this website
Computing the GCD
You are viewing a single comment's thread. Return to all comments →
Elixir