Last active
May 6, 2020 18:29
-
-
Save mareknowak/ae28009492308cac5f1d605ac525c798 to your computer and use it in GitHub Desktop.
1.9
This file contains hidden or 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
| %% @doc Functions for calculating perimeter and area of a right angled triangle | |
| -module(second). | |
| -export([hypotenuse/2, perimeter/2, area/2]). | |
| hypotenuse(A, B) -> | |
| math:sqrt(first:square(A) + first:square(B)). | |
| %% @doc Perimeter of a right angled triangle | |
| %% A, B - lengths of shorter sides | |
| %% C - hypotenuse | |
| perimeter(A, B) -> | |
| C = hypotenuse(A, B), | |
| (A + B + C). | |
| %% @doc Area of a right angled triangle | |
| %% A, B - lengths of shorter sides | |
| %% instead of (0.5 * A * B) we have more | |
| %% fancy area calculation | |
| area(A, B) -> | |
| C = hypotenuse(A, B), | |
| first:area(A, B, C). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice docs!!! You can add an
@doctag to them to allowedocto generate project documentation eventually.