Skip to content
example.erl 250 B
Newer Older
Sergio Pérez's avatar
Sergio Pérez committed
-module(example).
-export([main/0]).

main() ->
    {Sum,Prod} = sum_prod(10,10,0,0),
    io:format("~p",[Sum]),
    io:format("~p",[Prod]).

sum_prod(N,0,S,P) -> {S,P};
sum_prod(N,L,S,P) -> 
    S1 = S + 1,
    P1 = P + N,
    sum_prod(N,L-1,S1,P1).