Question: Given a money amount in dollars (floating point number), one needs to find out how many minimum numbers of total coins (including quarters, dimes, nickels

Given a money amount in dollars (floating point number), one needs to find out how many minimum numbers of total coins (including quarters, dimes, nickels and pennies) will be needed to make this amount. You need to write a program, that will take an user input for the money amount and then first convert the complete amount in cents (declare cents as integer).

Then first determine, how many quarters by dividing that amount by 25, and the remainder amount then divide by 10, and find how many dimes, and continue, the remainder after finding the nickels will be all pennies.

The algorithm is simple:

Quarters = cents / 25 cents = cents % 25

Dimes = cents / 10

cents = cents %10

etc.

Display number of quarters, dimes, nickels, and pennies and also the total number of coins by adding Quarters + Dimes + Nickels + Cents

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!