Skip to content

Instantly share code, notes, and snippets.

@huyderman
Created April 25, 2013 13:49
Show Gist options
  • Save huyderman/5459828 to your computer and use it in GitHub Desktop.
Save huyderman/5459828 to your computer and use it in GitHub Desktop.
Math
# Calculates the area of a triangle given the length of it's sides
def heron(a, b, c)
s = (a+b+c)/2
Math.sqrt(s*(s-a)*(s-b)*(s-c))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment