Calculate the amount of change you get:
$5 - $4.77 = $0.23
This can only be made up of pennies ($0.01), nickels ($0.05), or dimes ($0.10). Then you can get this amounts in the form of
• 23 pennies
• 18 pennies and 1 nickel
• 13 pennies and 2 nickels
• 13 pennies and 1 dime
• 8 pennies and 3 nickels
• 8 pennies, 1 nickel, and 1 dime
• 3 pennies and 4 nickels
• 3 pennies, 2 nickels, and 1 dime
• 3 pennies and 2 dimes
so there are 9 ways to get 23 cents.