There are 4 pennies. I got this by doing:
40-16=24
16 dimes so far
24/2=12
16 dimes, 12 quarters
16+12=28 40-28=12
12 coins left
Then I drew a diagram and for every 1 penny I drew 2 nickels. In order to get 12 overall in pennies and nickels there has to be 8 nickels and 4 pennies.
Hope that helped! :)