Skip to content

Instantly share code, notes, and snippets.

@raphamorim
Created March 10, 2017 20:34
Show Gist options
  • Save raphamorim/c01eaf18bc25224051a8228b57e88e18 to your computer and use it in GitHub Desktop.
Save raphamorim/c01eaf18bc25224051a8228b57e88e18 to your computer and use it in GitHub Desktop.
Input SUM
defmodule Solution do
defp sum(a, b), do: a + b
def main() do
a = IO.gets("") |> String.strip |> String.to_integer
range = 1..a
Enum.reduce(range, 0, fn(x, acc) -> sum(acc, IO.gets("") |> String.strip |> String.to_integer) end)
|> IO.puts
end
end
Solution.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment