0

Can you give me the key to solve this:

you will be given three values a,b,c lengths of the sides of a triangle -->>> you should output if they can built a triangle or not //B-)

16th Aug 2017, 12:29 PM
AmirDiab
AmirDiab - avatar
2 Respuestas
+ 1
Read this: https://en.wikipedia.org/wiki/Triangle_inequality The triangle inequality theorem states that the sum of the side lengths of any 2 sides of a triangle must exceed the length of the third side. int a = 15, b = 36, c = 50; std::cout << std::boolalpha << (a + b > c && a + c > b && b + c > a) << std::endl;
16th Aug 2017, 1:32 PM
Dennis
Dennis - avatar
0
👍👍👍very nice thx
16th Aug 2017, 1:35 PM
AmirDiab
AmirDiab - avatar