Integers are read until the number 0 is met. Display all triplets of numbers read consecutively, with the property that they can represent the sides of an isosceles triangle.Create this program as simple as possible without subprograms and using a loop..Please :**
How about you have a go at this yourself?- you don't appear to write much code, but you get an awful lot of help.
"Isosceles" - two (and presumably not three) sides equal; so two of the numbers are the same.
"Triangle" - so:
- all strictly positive;
- they satisfy the triangle inequality; in this case, the non-equal one is less than the sum of the other two.
Anyway, my advice is:
(1) You at least try writing some code.
(2) Your code selects the triplets of integers of the form a,a,b (in some order), where a and b are both positive and b < 2a.
Shouldn't the tests for 0 be before the tests for side equality? Also, just because 2 sides are equal this doesn't mean it's a triangle. To be a valid triangle, the 3rd side has to be less than the sum of the other 2 sides.