Skip to content

Instantly share code, notes, and snippets.

@Joakineee
Created May 6, 2020 14:18
Show Gist options
  • Save Joakineee/ffcd33d6543aca37819c227a85042e35 to your computer and use it in GitHub Desktop.
Save Joakineee/ffcd33d6543aca37819c227a85042e35 to your computer and use it in GitHub Desktop.
My first Erlang program
-module(first).
-export([double/1,mult/2,area/3,square/1,treble/1]).
mult(X,Y) ->
X*Y.
double(X) ->
mult(2,X).
area(A,B,C) ->
S = (A+B+C)/2,
math:sqrt(S*(S-A)*(S-B)*(S-C)).
square(X) ->
X*X.
treble(X) ->
X*X*X.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment