Let V be the volume of the tank. The inlet pipe fills the tank at a rate of
V / (5 hours) = 0.2V / hour
and the outlet pipe drains it at a rate of
V / (8 hours) = 0.125V / hour
With both valves open, the net rate of water entering the tank is
(0.2V - 0.125V ) / hour = 0.075V / hour
If t is the time it takes for the tank to be full, then
(0.075V ) / hour • t = V
Solve for t :
t = V / ((0.075V ) / hour)
t = 1/0.075 hour
t ≈ 13.333 hours