# Pipes and Cisterns in C++

Pipes and cisterns problem is a very common problem and is generally included in competitive exams. So, learning questions related to pipers and cisterns is important and you should know how to solve them as these are not too difficult to learn.

## Pipes and cisterns

These problems involve pipes that are used to either fill or empty a tank/reservoir/cistern.

Here, are some basics of pipes and cisterns problem,

• The pipes are inlet pipes or outlet pipes. Inlet pipe fills the tank and the outlet pipe empties the tank.

• If a pipe fills/empties in ‘n’ hours and the capacity of the tank is ‘c’ liters. Then in 1 hour in will empty c/n liters.

• Now, if there are some pipes filling the tank and some pipes emptying the tank. Together they will work in the following way,

1 hr = Σ (c/fi) - Σ (c/ej)

Here, fi is the time taken by ith pipe to fill the tank and ej is the time taken by jth pipe to fill the tank.

The sign of this calculation will show the end result of all pipes. Positive will fill the tank and negative will empty the tank.

Now, let’s solve some problems that will help to understand the topic better,

## Question 1

If two pipes fill a tank separately in 6 hours and 4 hours. In how much time will they fill the tank when opened together?

## Solution

Part of the tank filled by pipe A in one hour = 1/6.

Part of the tank filled by pipe B in one hour = 1/4.

Part of the tank fill by pipe A and B together in one hour = 1/6 + 1/4 = 5/12.

The time required yo fill the tank by both A and B is 12/5 hours.

## Question 2

There are 3 pipes in the tank out of these two pipes that fill the tank in 10 hours and 15 hours separately. And third, empties the tank in 12 hours.

If all three pipes are opened together, in how much time will they fill the tank will fill/empty?

## Solution

Part of the tank filled by pipe A in one hour = 1/10.

Part of the tank filled by pipe B in one hour = 1/15.

Part of tank emptied by pipe C in one hour = 1/12.

Part of tank fill/emptied by pipe A and B and C together in one hour = 1/10 + 1/15 - 1/12 = 5/60 = 1/12.

The tank will fill as the sign is positive.

The time taken to fill the tank is 12 hours.

## Question 3

There are 2 inlet pipes in a tank. Both the pipes together work to fill the tank in 6 hours. On working alone pipe one takes 5 hours less to fill the tank. In how much time will pipe 2 fill the tank alone.

## Solution

Let the time taken by pipe one is t hours.

Time taken by pipe two is t+5 hours.

Part of the tank filled by pipe one in one hour = 1/t

Part of the tank filled by pipe two in one hour = 1/(t+5)

Part of tank filled by pipe one and two together in one hour = 1/t + 1/(t+5) = (2t+5)/t*(t+5)

Both pipes together will fill tank together in 6 hours.

(2t+5)/t*(t+5) =1/6
12t + 30 = t2 + 5t
0 = t2 + 5t - 12t - 30
t2 - 7t - 30 = 0
t2 - 10t + 3t - 30 = 0
t(t - 10) + 3(t - 10) = 0
(t + 3)(t - 10) = 0
t = 10 hours

Time taken by pipe one is 10 hours

Time taken by pipe two is 15 hours

## Question 4

There are three pipes A, B and C. A fills the tank in 5 hours, B fills the tank in 15 hours and the third tank empties the tank. If all three are open together, it takes 15 minutes extra as compared to A and B open together. What is the time taken by C to empty the tank?

## Solution

Capacity of tank is LCM(5,15) = 15 units.

The efficiency of pipe A = 3 units/hr

Efficiency of pipe B = 1 units/hr

Efficiency of pipe A+B = 4 units/hr

Time is taken by A and B to fill the tank = 15/4 = 3 hours 45 minutes.

Time is taken to fill the tank when all pipes are open = 3 hours 45 minutes + 15 minutes = 4 hours.

Total efficiency is 15/4 = 3.75 units per hour

Efficiency of pipe C = Efficiency of pipe A+B - total efficiency = 0.25 units per hour.

Time taken by C = 15*0.25 = 3 hours 45 minutes

Updated on: 17-Apr-2020

103 Views 