Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Jorge Andres Gonzales A01280927
- % Andres Sosa Silva A01176075
- -module(ej2).
- -export([calcula/2]).
- calcula(N,M)->
- receive
- {suma,X,Y} ->
- io:format("Suma: ~p~n",[X+Y]),
- calcula(N+X+Y,X+Y);
- {multiplica, X, Y} ->
- io:format("Multiplicacion: ~p~n",[X*Y]),
- calcula(N+X*Y,X*Y);
- {ultimo, P} ->
- io:format("Valor mas reciente ~p mandado a : ~p~n", [M,P]),
- %P ! {resultado,M},
- calcula(N,M);
- {total, P} ->
- io:format("Caulculo total ~p mandado a : ~p~n", [N,P]),
- %P ! {resultado,N},
- calcula(N,M);
- {termina} ->
- io:format("Done ~n", [])
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement