Give me logic to determine if the 3 sides represent a side of a triangle.
Last edited on
The logic is given by the triangle inequality.
Given two side lengths a and b, the 3rd side c must satisfy
|a-b| <= c <= a+b
thnks fun2code,
I just found on internet.
It is a series of three inequalities: a+b>c, a+c>b, and b+c>a, if all are true then its a triangle.