Your problem might be more logical than with just code. The pset seems to ask more how many quarters, dimes, nickels, and pennyspennies at a minimum can you get to the exact change needed. This requires you to at least do some subtraction with n. You want to constantly subtract n with the maximum amount of cash you can subtract (25, 10, 5, or 1) without going below 0.
In any other case though, you might also be doing a while loop wrong, it should look like this:
while (n < 0)
{
<put//put code here that will run if n < 0>0
}
Good luck on this pset though!