Given an amount less than $1.00, compute the number of quarters, dimes, nickels, and pennies needed.
so i'd need a variable for quarters, dimes, nickels, & pennies. and another variable..... not sure exactly how to do this though
Printable View
Given an amount less than $1.00, compute the number of quarters, dimes, nickels, and pennies needed.
so i'd need a variable for quarters, dimes, nickels, & pennies. and another variable..... not sure exactly how to do this though
I take it you haven't studied math, then it can be somewhat tricky. But for starters, you need to google diophantine equations.
In this thread, what you ask is answered.
Why couldn't you just use loops and start with subtracting quarters, then go smaller and smaller(dimes, nickels, pennies).
for example, with 67 cents, it would start with a loop that subtracted 25 twice, each time adding 1 to quarters, then once the amount inquestion is less than 25, do a similar action for the other coins(17- 10 would leave 1 dime, 7-5 would leave one nickel, etc)?
i can draw up an example of the actual code if necessary.