Monday, July 27, 2009

How to distribute denominator using c language?

Hi!,


can someone help me to make a program using C language that will accept amount of money then determine the distribution of denominators?





this is the output:





example:








Enter amount:5276





1000=5


500=0


100=2


50=1


20=1


10=0


5=1


1=1

How to distribute denominator using c language?
Start with the biggest, and work your way down. So start by seeing how many 1000s you can extract from the start number, in your example this would be 5. Then subtract 5 x 1000 from the start number, leaving 276. Then count the number of 500s - 0. Subtract = 276. Count 100s - 2. Subtract = 76. and so on. Once you understand this method, the code should come easily.





Rawlyn.


No comments:

Post a Comment