This Challenge Makes Cents

JavaScript ES6, 107 bytes

n=>((n*=100)/25|0)+` quarter ${(n%=25)/10|0} dime ${n%10/5|0} nickel ${n%5|0} penny`.replace(/ ?0 \S+/g,"")

Simple maths.


Python 2, 120 bytes

n=int(round(input()*100))
a=25
for b in"quarter","dime","nickel","penny":
 if n>=a:print"%d "%(n/a)+b,
 n%=a;a=40/a+5^12

Just to be safe, changed to something that definitely works to fix @Ogaday's comment, for now at least. I'm uncertain whether or not I need the int() as well, but I'm having trouble convincing myself that I don't.

print`n/a`+" "+b,

is an extra byte off, but prints an extra L for large inputs (although this code doesn't work for extremely large inputs anyway, due to float precision).


dc, 104

Newlines added for "readability":

[dn[ quarter ]n]sq
[dn[ dime ]n]sd
[dn[ nickel ]n]sn
[d1/n[ penny ]n]sp
?A0*
25~rd0<qst
A~rd0<dst
5~rd0<nst
d0<p

Tags:

Code Golf