Skip to content

Instantly share code, notes, and snippets.

@Parabellum1905y
Created February 27, 2017 18:39
Show Gist options
  • Save Parabellum1905y/88f4c051f6323ede61b680d9a0600e21 to your computer and use it in GitHub Desktop.
Save Parabellum1905y/88f4c051f6323ede61b680d9a0600e21 to your computer and use it in GitHub Desktop.
-module(first).
-export([mult/2, triangleArea/3, square/1, treble/1]).
mult(X, Y)->
X*Y.
%%mult(2, 3).
%%P = 10,12.
triangleArea (A,B,C) ->
S = (A+B+C)/2,
math:sqrt(S*(S-A)*(S-B)*(S-C)).
treble(A)->
A*3.
square(A)->
A*A.
-module(second).
-export([hypotenuse/2, perimeter/2, area/2]).
hypotenuse(A,B)->
Asquare = first:square(A),
Bsquare = first:square(B),
math:sqrt(Asquare+Bsquare).
perimeter(A,B)->
hypotenuse(A,B)+A+B.
area(A,B)->
A*B*0.5.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment