The sum of angles in a triangle is 180°.
.. (x +40) +(3x -17) +(2x -5) = 180 . . . . . angle relationship in a triangle
.. 6x +18 = 180 . . . . . . . . . . . . . . . . . . . .simplify the sum
.. x +3 = 30 . . . . . . . . . . . . . . . . . . . . . . .divide by 6; then subtract 3
.. x = 27
_____
Check:
The angles are 67°, 64°, 49°, which add to 180°.