defmodule Main do def main do num = IO.gets("") |> String.trim |> String.to_integer Enum.each(1..num, fn n -> check_fizzbuzz(n) |> IO.puts end) end defp check_fizzbuzz(num) do cond do rem(num, 3) == 0 && rem(num, 5) == 0 -> "FizzBuzz" rem(num, 3) == 0 -> "Fizz" rem(num, 5) == 0 -> "Buzz" true -> to_string(num) end end end