calculate the value of x in each case

First taking small triangle,
Perpendicular(P') = 5cm
Base(B) = y (let)
Hypotenuse(H') = 12cm
so,
(H')² = (P')² + (B)²
(12)² = (5)² + (y)²
(y)² = 144 - 25
(y)² = 119
Now taking big triangle,
Perpendicular (P) = 12+5 = 17cm
Base (B) = y (already supposed)
Hypotenuse (H) = x
so,
(H)² = (P)² + (B)²
(x)² = (17)² + (y)²
(x)² = 289 + 119 = 408
x = √408