To solve this question, we can use the concept of the rate of work.
Let's say that the capacity of the tank is 1 unit.
Pipe A can fill the tank in 20 minutes, which means it can fill 1/20 of the tank in 1 minute.
Pipe B can fill the tank in 30 minutes, which means it can fill 1/30 of the tank in 1 minute.
Pipe C can empty the tank in 40 minutes, which means it can empty 1/40 of the tank in 1 minute.
When all three pipes work together, the net rate of work will be the sum of their individual rates.
So, the net rate of work = (1/20 + 1/30 - 1/40) tank per minute
To find the time taken to fill the tank, we can use the formula:
Time = 1 / (Net rate of work)
Time = 1 / (1/20 + 1/30 - 1/40)
Simplifying this expression, we get:
Time = 17 1/7 minutes
Therefore, the correct answer is option A) 17 1/7 minutes.