Let x,y,z represent the amount of nickels dimes and quaters respectively.
You also know that,
Solve for x in first equation,
gcd(1,4)=1 which divides 40 there is a solution.
The rest is up to you to solve this.
If you are interesting this is called, Bezout's Identity