I don't know what you did there but if you calculate your x you get twice as much than it really is.
Given that triangle A has its legs with lengths 4 and 7, you want to create another triangle B that's similar where the smaller leg has a length of 5. Determine the length of the other leg. Then determine its hypotenuse.
4/7 = 5/x means that x = 35/4 so that's the length of the 2nd leg
Then, I am assuming the hypotenuse will be proportional if the sides are (by default), so it is then:
(35/4)^2 + 5^2 = x^2 means that x = 5*sqrt(65)/4
Is this right?