Question: To do this, you can first convert the input amount into cents: $xx . xx * 1 0 0 ( cents ) ( Alternatively ,

To do this, you can first convert the input amount into cents:
$xx.xx *100(cents)
(Alternatively, you can input $xx.xx as a string using the string library. You
can then read each character and convert it back into a number like $10.74
would be dissected as 1,0,.... Each character can be converted back to
numeric value by subtracting it from 0 like 10 becomes number 1.)
You now have an integer number of pennies that need to be divided into 25,
10,5 and single pennies. The coin designations are easily found by an
algorithm the uses the two operators (/ for int division) and (% for remaining
amount). The algorithm is shown below

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!