U E D R , A S I H C RSS

로마숫자바꾸기/Damien Rice

모듈 소스
%rome.erl
-module(rome).
-export([rome/3]).

rome(99, L, A) -> "exit";
rome(0, L, A) -> L;
rome(Number, L, A) ->
    case Number > 10 of
	true ->
	    rome(Number-10, "X "++L, A);
	false ->
	    rome(0, L++" "++element(Number rem 11, A), A)
    end.

콘솔
A = {"I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X"}.
c(rome).
rome:rome(38, "", A).

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:22
Processing time 0.0129 sec