Asok Said:
Quote:
any thread with the topic title is general such as "I need help" "help me please" "Help fast ASAP" will be deleted and you will not recieve help.
Anyway... You could devide the total by the highest value that can be held by a bill (round down), then multiply the quocient by the value of that bill, then subtract the product from the inputted value, then do the same with the other bill and coin values in decending order.
Ex:
code: |
var input, NumBill50, NumBill50Round : real
var NumBills : int
Const DOLLARS50 := 50
NumBill50 := input / DOLLARS50 %Devide the input by 50 for $50 bill
NumBill50Round := input div DOLLARS50 %Same as ^ with rounding
if NumBill50 < NumBill50Round then %If the unrounded quocient is
NumBill50Round -= 1 %Lower than the rounded
end if %quocient, It has rounded up,
%Keep Track of the number of $50 bills... %but it must round down so
%we subtract one.
input -= NumBill50Round
%Then do the same thing with the next bill or coin value and so on
%Yes, I am aware that $50 is not the highest Canadian bill value. |