Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -module(second).
- -export([perimeter/2,hypotenuse/2,area/2]).
- hypotenuse(A,B) ->
- %The square on the hypotenuse is equal to the sum of the square on the other two sides
- %To get the hypotenuse we take the square root
- math:sqrt(first:square(A)+first:square(B)).
- perimeter(A,B) ->
- %perimeter is the sum of all side. We know sort sides A, B
- %we can calculate the other side as it is the hypotenuse
- A+B+hypotenuse(A,B).
- area(A,B) ->
- %area is half of height times width (It is half a rectangle!)
- A*B/2.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement