Skip to content

Instantly share code, notes, and snippets.

@xiaods
Created November 14, 2013 01:30
Show Gist options
  • Save xiaods/7459718 to your computer and use it in GitHub Desktop.
Save xiaods/7459718 to your computer and use it in GitHub Desktop.
def triangle(a, b, c)
if a == 0 || b == 0 || c == 0
raise TriangleError
end
if((a+b < c) || (a+c < b) || (b+c < a))
raise TriangleError
end
if a == b && b == c # && a == c
:equilateral
elsif a == b || b == c || c == a
:isosceles
else
:scalene
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment