first.erl 296 B

12345678910111213141516171819202122232425262728
  1. -module(first).
  2. -export([double/1,
  3. treble/1,
  4. mult/2,
  5. square/1,
  6. area/3]).
  7. mult(X,Y) ->
  8. X*Y.
  9. double(X) ->
  10. mult(2,X).
  11. treble(X) ->
  12. mult(3,X).
  13. area(A,B,C) ->
  14. S = (A+B+C)/2,
  15. math:sqrt(S*(S-A)*(S-B)*(S-C)).
  16. square(X) ->
  17. mult(X, X).