4 Pints from 5 Pints and 3 Pints

Classic Problem
You have $2$ jars: one holds $5$ pints and one holds $3$ pints.

Neither jar is marked in any way.

You also have a cask with (to all intents and purposes) an unlimited supply of liquid, from which you may fill either jar.

You may also pour the liquid back from either jar into the cask.

The question is: how do you measure $4$ pints?

Solution
Fill the $3$ pint jug from the cask, and empty its contents into the $5$ pint jug.

Fill the $3$ pint jug from the cask again, and fill the $5$ pint jug from it.

There will then be $1$ pint in the $3$ pint jug.

Empty the $5$ pint jug into the cask.

Pour the $1$ pint from the $3$ pint jug into the $5$ pint jug, which now contains that $1$ pint of liquid.

Fill the $3$ pint jug from the cask, and pour its contents into the $5$ pint jug.

The $5$ pint jug now contains the required $4$ pints.