Re: pls help..how to find whether given numbers form side of a triangle

Quote:

Originally Posted by jvs1987

...whether given 3 numbers form the side of a triangle...

I think the problem statement might be something like:

Given three positive integers, how can you know whether it is possible to make a triangle with sides whose lengths are equal to those three values?
(Or something like that.)

If this is not the problem, then tell us what it is.

If this is the problem (or something like that), then consider that each side of a triangle must be less than the sum of the other two sides.

If you accept that truth, then you can eliminate any set of three positive integers for which one value is greater than or equal to the sum of the other two, so you can test the following three expressions

a >= b+c
b >= a+c
c >= a+b

If any one of them is true, then the three numbers can't be lengths of the sides of a triangle, right?

Now if all of those are false (for a given set of positive integers a, b, c), can you say for sure that it is possible to make a triangle whose sides are those values? (This is a geometry question, not a programming question.)

If you can say that, then just create a program that uses tests for those three expressions. (Or their logical inverses.)