• + 0 comments

    Erlang solution:

    -module(solution).
    -export([main/0]).
    
    read(X) ->
        case io:fread("", "~d") of
            eof -> ok;
            {ok, [N]} -> if (X rem 2=/=0)-> io:format("~p~n", [N]);
                             (X rem 2 =:=0)-> ok
                end,
            read(X+1)
        end.
    
    main() ->
        {ok,[X]} = io:fread("", "~d"),
        read(1).