Created
February 27, 2017 18:39
-
-
Save Parabellum1905y/88f4c051f6323ede61b680d9a0600e21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-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