Advertisement
johnpentyrch

first.erl

May 24th, 2020
2,274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Erlang 0.28 KB | None | 0 0
  1. -module(first).
  2.  
  3. -export([double/1,mult/2,area/3,square/1,treble/1]).
  4.  
  5.  
  6.  
  7. mult(X,Y) ->
  8.  
  9.     X*Y.
  10.  
  11.  
  12.  
  13. double(X) ->
  14.  
  15.     mult(2,X).
  16.  
  17.  
  18.  
  19. area(A,B,C) ->
  20.  
  21.     S = (A+B+C)/2,
  22.  
  23.     math:sqrt(S*(S-A)*(S-B)*(S-C)).
  24.  
  25. square(X) ->
  26.  
  27.     mult(X,X).
  28.    
  29. treble(X) ->
  30.  
  31.     mult(X,3).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement