let's assume that the lengths of the sides of the triangle are x, y, z. Where x is the longest and z is the shortest.
y = z +4 (as this side is longer than the shortest by 4cm)----> equation 1
y = x - 2 (as this side is shorter than the longest by 2cm)---> equation 2
x= y+2 (from equation 2 sub in 3)
x + y + z =38 -----> equation 3
(y+2)+ y + z =38
2 y +2 +z =38 (by subtracting both sides by 2)
2 y + z = 36 -----> equation 4
from equation # 1
y = z+4
y - z =4 (by adding this equation with equation number 4)
3y =36+4 =40
y = 40/3 = 13.3333 cm (sub in equation 1 and 2)
z = 13.3333-4 =9.3333 cm (from equation 1)
x= y+2 = 13.3333+2 = 15.3333cm