Since the OP specified water heaters,
@russ_watters answer was correct, but too easy. Another easy way to solve this is to assume mathematical physics tanks with zero coefficient of thermal expansion and infinite rigidity. In that case,
@anorlunda gave you the answer.
On the other hand, if you want to entertain yourself with some calculations, assume that the two tanks are made of real materials, filled with water (no air bubbles), sealed, and then heated. The calculation for each tank has three parts:
1) Thermal expansion of the water, which increases the pressure (water expands as it gets hotter).
2) Bulk modulus of the water (increased pressure decreases volume).
3) Thermal expansion of the tank, which makes it larger, so the pressure increases less (thermal coefficient of expansion of the tank).
4) Increased stress in the tank from the pressure, which makes it larger, so the pressure increases less (elastic modulus of the tank).
I have not put enough thought into this to know if there is a practical analytic solution. If I was solving it, I would use an iterative approach in a spreadsheet and let the solver do the work.
Data point: When the water line to my house cracked a couple months ago, we turned the pump off at night and shut off the valve to the water heater to keep it from draining down. On two occasions, the water heater thermostat kicked on while the valve was shut off. The pressure increased about 75 PSI.