pickzy.com

C  |  C++  |  Objective-C  |  VC++  |  Win32  |  MFC  |  Java  |  Php  |  Delphi  |  Visual Basic  |  .Net  |  Networking  |  General  |  Games  |  Jobs  |  Javascript  |  




Menu

pickSourcecode.com


        

 




 

Cpp > Solution

 

Cpp - 3 and a 5 litre water container puzzles

 You have a 3 and a 5 litre water container, each container has no markings except for that 
which gives you it's total volume. You also have a running tap. You must use the containers and the 
tap in such away as to exactly measure out 4 litres of water. How is this done?

Ans:

Number 1

Fill the 5 litre can from the tap
Empty the 5 litre can into the 3 litre can - leaving 2 litres in the 5 litre can.
Pore away the contents of the 3 litre can.
Fill the 3 litre can with the 2 litres from the 5 litre can - leaving 2 litres in the 3 litre can.
Fill the 5 litre can from the tap.
Fill the remaining 1 litre space in the 3 litre can from the 5 litre can.
Leaving 4 litres in the 5 litre can.

Number 2

Fill the 3 litre can from the tap.
Empty the contents of the 3 litre can into the 5 litre can.
Fill the 3 litre can from the tap.
Empty the contents of the 3 litre can into the 5 litre can.  - Leaving the 5 litre can full and 1 litre in the 3 litre can.
Pore away the contents of the 5 litre can
Pore the 1 litre from the 3 litre can into the 5 litre can.
Fill the 3 litre can from the tap.
Empty the contents of the 3 litre can into the 5 litre can.
Leaving 4 litres in the 5 litre can.

 
Privacy Policy | About Us