So basically they are asking me to write a program that calculates the number of bills of 100, 50, 20, 10, 5 to breakdown a quantity entered. But calculates the least quantity of bills of each type to make the quantity entered.
Any help appreciated.
3 replies to this topic
#1
Posted 03 August 2011 - 08:29 PM
|
|
|
#2
Posted 03 August 2011 - 09:58 PM
Before I proceed, I would like to thank everyone who greeted me this day. Very well-appreciated. :)
To Mr. rgmartino:
You can visit my site spammy link deleted
You can learn from it, at the same time, you could build your own understanding from the simple tutorials I've made from it.
Happy Coding! :D
To Mr. rgmartino:
You can visit my site spammy link deleted
You can learn from it, at the same time, you could build your own understanding from the simple tutorials I've made from it.
Happy Coding! :D
Edited by WingedPanther, 04 August 2011 - 07:55 AM.
delete spammy link
#3
Posted 04 August 2011 - 07:56 AM
@geralddevera: how about helping the op?
@rgmartino: you will probably want to use the / and % operators to do this. Is it going to be in C or C++?
Also, do you know how to break down $87 by hand?
@rgmartino: you will probably want to use the / and % operators to do this. Is it going to be in C or C++?
Also, do you know how to break down $87 by hand?
#4
Posted 09 August 2011 - 06:42 PM
Quote
do you know how to break down $87 by hand?
Let's say the number is 126.
(integer) 126 / 100 = 1
so it's 1 times $100.
126 % 100 = 126 - (126 / 100 * 100) = 126 - (1 * 100) = 126 - 100 = 26
26 / 50 = 0
so it's 0 times $50.
26 % 50 = 26
26 / 20 = 1
so it's 1 times $20.
26 % 20 = 6
6 / 10 = 0
so it's 0 times $10.
6 % 10 = 6
6 / 5 = 1
so it's 1 times $5.
6 % 5 = 1
then we have $1 left over.
So the answer would be one $100 bill, one $20 bill, one $5 bill, and remaining $1. That's sort of the idea, I think.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









