The length of the hypotenuse equals to the square root of the sum of the square of the other two sides.
12x12+16x16=144+256=400
The square root of 400 is 20.
By the same way, you can find the length of the hypotenuse of the reduced triangle
9x9+12x12=81+144=225
The square root of 225 is 15
The length of the hypotenuse is 15
The perimeter =12+9+15
The perimeter=36