Answer:
name = input("Enter name: ")
change = float(input("Enter change in cents: "))
half_dollars = int(change / 50)
change %= 50
quarters = int(change / 25)
change %= 25
dimes = int(change / 10)
change %= 10
nickels = int(change / 5)
change %= 5
pennies = int(change)
print("Half dollars: " + str(half_dollars) + ", Quarters: " + str(quarters) + ", Dimes: " + str(dimes) + ", Nickels: " + str(nickels) + ", Pennies: " + str(pennies))
Explanation:
*The code is in Python.
Ask the user to enter the name and change in cents
Calculate the number of half dollars, quarters, dimes, nickels, and pennies, use division and modulo operator
Print the results
Let me demonstrate calculating the half_dollars:
Let's say the user enter 134 for the change.
half_dollars = int(change / 50) → int(134/50) → int(2.68) = 2
change %= 50 (same as change = change % 50) → 134 % 50 → 34