9514 1404 393
Step-by-step explanation:
1: fill the 3-gallon jug, empty it into the 5-gallon jug. Fill the 3-gallon jug again, and finish filling the 5-gallon jug from the 3-gallon jug. The 3-gallon jug will hold 1 gallon. (3×2-5=1)
2: fill the 5-gallon jug, fill the 3-gallon jug from it. The 5-gallon jug will hold 2 gallons. (5-3=2)
3: fill the 3-gallon jug. It will hold 3 gallons.
4: fill the 5-gallon jug, fill the 3-gallon jug from it. Dump the 3-gallon jug and empty the remaining 2 gallons from the 5-gallon jug into it. Fill the 5-gallon jug and finish filling the 3-gallon jug from it. The 5-gallon jug will hold 4 gallons. (5×2-3×2=4)
5: fill the 5-gallon jug. It will hold 5 gallons.
6: fill the 3-gallon jug, empty it into the 5-gallon jug. Fill the 3-gallon jug again. The jugs hold a total of 6 gallons. (3×2=6)
7: Do the procedure for 4 gallons. The jugs together hold 7 gallons. (5×2-3=7)
8: fill both jugs. Together, they hold 8 gallons. (5+3=8)