Let the base (BC) of the right triangle = x cm
So, altitude (AB) = (x – 7) cm
And hypotenuse (AC) = 13 cm
According to Pythagoras theorem,
AC2 = AB2 + BC2 ⇒ (13)2 = (x – 7)2 + (x)2
⇒ 169 = x2 + 49 – 14x + x2
⇒ 169 = 2x2 – 14x + 49
⇒ 2x2 – 14x – 120 = 0
⇒ x2 – 7x – 60 = 0
⇒ x2 – 12x + 5x – 60 = 0
⇒ x(x - 12) + 5(x – 12) = 0
⇒ (x + 5) (x – 12) = 0
⇒ x + 5 = 0
or x- 12 = 0
⇒ x = –5
or x = 12
Since side of triangle is never negative So,
 x = 12
Now required sides of the triangle are
AB = x – 7
= 12 – 7 = 5 cm
BC = x = 12 cm.