Answer:
The program in Python is as follows:
dollar = float(input("Dollars: "))
t20bill = int(dollar//20)
dollar -= t20bill * 20
t10bill = int(dollar//10)
dollar -= t10bill * 10
t5bill = int(dollar//5)
dollar -= t5bill * 5
t1bill = int(dollar//1)
dollar-= t1bill * 1
qtr = int(dollar//0.25)
dollar -= qtr * 0.25
dime = int(dollar//0.10)
dollar -= dime * 0.10
nkl = int(dollar//0.05)
dollar -= nkl * 0.05
pny = round(dollar/0.01)
if t20bill != 0: print(t20bill,"$20 bills")
if t10bill != 0: print(t10bill,"$10 bills")
if t5bill != 0: print(t5bill,"$5 bills")
if t1bill != 0: print(t1bill,"$1 bills")
if qtr != 0: print(qtr,"quarters")
if dime != 0: print(dime,"dimes")
if nkl != 0: print(nkl,"nickels")
if pny != 0: print(pny,"pennies")
Explanation:
This gets input for dollars
dollar = float(input("Dollars: "))
Calculate the number of $20 bills
t20bill = int(dollar//20)
Calculate the remaining dollars
dollar -= t20bill * 20
Calculate the number of $10 bills
t10bill = int(dollar//10)
Calculate the remaining dollars
dollar -= t10bill * 10
Calculate the number of $5 bills
t5bill = int(dollar//5)
Calculate the remaining dollars
dollar -= t5bill * 5
Calculate the number of $1 bills
t1bill = int(dollar//1)
Calculate the remaining dollars
dollar-= t1bill * 1
Calculate the number of quarter coins
qtr = int(dollar//0.25)
Calculate the remaining dollars
dollar -= qtr * 0.25
Calculate the number of dime coins
dime = int(dollar//0.10)
Calculate the remaining dollars
dollar -= dime * 0.10
Calculate the number of nickel coins
nkl = int(dollar//0.05)
Calculate the remaining dollars
dollar -= nkl * 0.05
Calculate the number of penny coins
pny = round(dollar/0.01)
The following print the number of bills or coins. The if statement is used to prevent printing of 0
<em>if t20bill != 0: print(t20bill,"$20 bills")</em>
<em>if t10bill != 0: print(t10bill,"$10 bills")</em>
<em>if t5bill != 0: print(t5bill,"$5 bills")</em>
<em>if t1bill != 0: print(t1bill,"$1 bills")</em>
<em>if qtr != 0: print(qtr,"quarters")</em>
<em>if dime != 0: print(dime,"dimes")</em>
<em>if nkl != 0: print(nkl,"nickels")</em>
<em>if pny != 0: print(pny,"pennies")</em>