Let x be length of shorter leg
4cm longer than the shorter leg x + 4 = length of longer leg
hypotenuse is 8 cm longer than the shorter
x + 8 = length of hypotenuse
phytagorus rule
x^2 + (x+4)^2 = (x+8)^2
x^2 + x^2 +8 x + 4^2 = x^2 + 16x + 8^2
x^2 - 8x - 48 =0
(x + 4 ) (x - 12) - 0
x= - 4 we reject negative number
so x= 12