You are viewing a single comment's thread. Return to all comments →
Elixir solution:
defmodule Gdc do def main do IO.read(:stdio, :line) |> String.split |> Enum.map(&String.to_integer(&1)) |> compute_gdc |> IO.inspect end def compute_gdc(list) do {min, max} = Enum.min_max(list) reminder = rem(max, min) if reminder > 0, do: compute_gdc([reminder, min]), else: min end end Gdc.main
Computing the GCD
You are viewing a single comment's thread. Return to all comments →
Elixir solution: