A Collection of Code Snippets in as Many Programming Languages as Possible

This project is maintained by TheRenegadeCoder

Welcome to the Factorial in Erlang page! Here, you'll find the source code for this program as well as a description of how the program works.

```
-module(factorial).
-export([start/1]).
-spec start(Number :: integer()) -> integer().
start(N)
when N<0;
not is_integer(N) ->
io:format("Usage: please input a non-negative integer~n");
start(0) ->
factorial(1,1);
start(N) ->
factorial(N,N).
%%--------------------------------------------------------------------
%% Recursively multiply N times N-1 until N-1=1. Output Accumulator
%%--------------------------------------------------------------------
factorial(1,Acc) ->
io:format("~w~n", [Acc]);
factorial(N,Acc) ->
factorial(N-1, (N-1)*Acc).
```

Factorial in Erlang was written by:

- Mark Magahis

If you see anything you'd like to change or update, please consider contributing.

No 'How to Implement the Solution' section available. Please consider contributing.

No 'How to Run the Solution' section available. Please consider contributing.