Given taps X and Y can fill the tank in 30 and 40 minutes respectively. Therefore,
part filled by tap X in 1 minute = 1/30
part filled by tap Y in 1 minute = 1/40
Tap Z can empty the tank in 60 minutes. Therefore,
part emptied by tap Z in 1 minute = 1/60
Net part filled by Pipes X,Y,Z together in 1 minute = [1/30 +1/40 - 1/60] = 5/120 = 1/24
i.e., the tank can be filled in 24 minutes.