This is a unit conversion problem. We need to know how many gallons are there in 40 pints and with this information we will know in which tank he will need to fill in the bottles. In order to solve it we need the equivalence between this two measurement units. Which is:
This equivalence can be used as a conversion factor like this:
Applying it to the problem we can convert from pints to gallons:
He will need both tanks because neither of them has enough gallons to fill 40 one pint bottles.
One gallon is equal to 8 pints only filling 8 bottles per gallon so if you do 8×2 you can only fill 16 bottles so thats not enough and when you do 8×3=24 its still not enough to fill all 40 bottles so he would need both tanks to fill all 40 bottles 8×5=40