The formula with 40 substituted
L/100km = 235.214583 ÷ 40 = 5.88
The constant is an exact definition, not a rounded factor: the mile is 1.609344 km, the US gallon is 3.785411784 litres and the imperial gallon is 4.54609 litres. The MPG to L/100km Converter explains where each comes from and gives a longer table.
The same 40 mpg (US) is 48.04 mpg on the imperial gallon, 5.88 L/100km and 17.01 km/L. If your 40 mpg figure came from a British source it already uses the imperial gallon, and the metric answer is 7.06 L/100km instead.
What 40 mpg (US) means in practice
40 mpg (US) is 5.88 L/100km, a figure that once needed a diesel and now needs only a mild hybrid. It is 48.0 mpg in imperial gallons, a number that confuses buyers comparing US and UK reviews.