40% can be expressed as 40/100 or 0.4
[tex]\frac{40}{100} \times x = 5\\\\0.4 \times x = 5[/tex]
Divide both sides by 0.4 to isolate 'x'
[tex]0.4x = 5\\\\\frac{0.4x}{0.4} = \frac{5}{0.4}\\\\x = \frac{5}{0.4} \\\\\boxed{\bf{x = 12.5}}[/tex]
40% of 12.5 is 5.