64 642
Assignments Done
99,2%
Successfully Done
In September 2018

# Answer to Question #6927 in C++ for azhar

Question #6927
write a step by step instructions in english to calculate the fewest number of dollar bills needed to pay a bill of amount TOTAL.for examlpe,if TOTAL is $283,the bills would consist of two$100 bills,one $50 bill,one$20 bill,one $10 bill,one$5 bill,one $2 bill,and one$1 bill.(For this exercise assume that only $100,$50,$20,$10,$5,$2,$1 bills are available.)Do not write program in c++ Expert's answer take ourstarting number, for example368. 1)divide 368 by100.368/100= 3.68, we take only an integer - 3, this means that the bills would consist of 3 -$100 bills,

thensubtract from 368 our 3 - $100 bills.368-300= 68. 2) divide 68 by50.68/50= 1.36, we takeonly an integer - 1, this means that the bills would consist of 1 -$50 bills,

thensubtract from 68 our 1 - $50 bills.68-50= 18. 3) divide 18 by20. 18/20= 0.9, we have a number less then zero, this means that the bills would not consist a$50 bills,

and we move on...

4) divide 18 by 10. 18/10 = 1.8,

we take only an integer - 1,

this means that the bills would consist of 1 - $10 bills, then subtract from 18 our 1 -$10 bills. 18-10 = 8.

5) divide 8 by 5. 8/5 = 1.6,

we take only an integer - 1,

this means that the bills would consist of 1 - $5 bills, then subtract from 8 our 1 -$5 bills. 8-5 = 3.

6) divide 3 by 2. 3/2 = 1.5,
we take only an integer - 1,
this means that the bills would consist of 1 - $2 bills, then subtract from 3 our 1 -$2 bills. 3-2 = 1.

7) divide 1 by 1. 1/1 = 1,
we have an integer - 1,
this means that the bills would consist of 1 - \$1 bills,
and this means that the algorithm is finished!

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!