If we just play with the jugs, we'll find that we can pour water back and forth between them as follows:
- Fill 5 quart jugs
- Fill 3 quart with 5 quart.
- Dump 3 quart.
- Fill 3 quart with remains of 5 quart (2 quarts)
- Fill 5 quart.
- Fill remainder of 3 quart with 5 quart.
- 4 quarts will be left inside of 5.
This question, like many puzzle questions, has a math/ computer science root. If the two jug sizes are relatively prime, you can measure any value between one and the sum of the jug sizes.