hi everyone, how can I make a money changer program? like, if the user inputed 100 pesos and you want it to change by two 50 pesos...another example: if the user inputed 1000 pesos and you want it to change by one 500 pesos and five 100pesos. my program should be in .C file extension
hope you will help me.. thanks in advance!
(by the way pesos is the currency in Philippines)
C programming Probelem..Money changer?
You currently have the following currency.
Peso Notes
5
10
20
50
100
200
500
1000
centavos
1
5
10
25
Take the input and divide it in turn by each amount starting with the highest note.
The integer from the division is the number of that item that you want for change. The remainder becomes the new input value.
Stop when the input is zero.
It should be noted that the remainder from dividing 5 centavos will be the result for 1 centavos so you do not have to do this final divide. However it may be easier to code the divide to keep the program simple.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment