Skip to content

Instantly share code, notes, and snippets.

@stomatocode
Created April 10, 2013 20:12
Show Gist options
  • Save stomatocode/5358029 to your computer and use it in GitHub Desktop.
Save stomatocode/5358029 to your computer and use it in GitHub Desktop.
# test to see if valid triangle
def valid_triangle?(a, b, c)
if ((a == 0 or b == 0 or c == 0) or (a == nil or b == nil or c == nil))
return false
end
if a + b > c
return true
elsif a + c > b
return true
elsif b + c > a
return true
else
return false
end
end
puts valid_triangle?(1,6,0)
puts valid_triangle?(11,1,11)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment