blob: c822808b905de407aac7bd7ecd81b9461a92d7f9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
|
#!/usr/bin/env escript
-mode(compile).
main([In]) ->
X = list_to_integer(In),
N = fac(X),
io:format("factorial ~w = ~w~n",[X, N]).
fac(0) -> 1;
fac(N) ->
N * fac(N-1).
|