Hi there,
Im putting a whole number representing gift voucher amount into a text box and want to display the correct quantity and denomination of vouchers required to make up the total amount required in 4 other text boxes.
Box1 = "Claimed"
Box2 = "20's"
Box3 = "10's"
Box4 = "5's"
Box5 = "1's"
i.e. if the amount is £39
this needs 1 x £20, 1 x £10, 1 x £5, 4 x £1 vouchers to fulfill the order.
Is there a simple/slick way of coding this, starting with the highest denomination to see if the whole number is divisible by that, then working down through the other denominations dealing with any remainder as you go, to see if that is divisible by a lesser denomination?
As this is only dealing with whole numbers, there won't be any fractions left over so they don't need to be dealt with, i'm just keen to see how complex or simple the function would be.
Thanks
Vince
Im putting a whole number representing gift voucher amount into a text box and want to display the correct quantity and denomination of vouchers required to make up the total amount required in 4 other text boxes.
Box1 = "Claimed"
Box2 = "20's"
Box3 = "10's"
Box4 = "5's"
Box5 = "1's"
i.e. if the amount is £39
this needs 1 x £20, 1 x £10, 1 x £5, 4 x £1 vouchers to fulfill the order.
Is there a simple/slick way of coding this, starting with the highest denomination to see if the whole number is divisible by that, then working down through the other denominations dealing with any remainder as you go, to see if that is divisible by a lesser denomination?
As this is only dealing with whole numbers, there won't be any fractions left over so they don't need to be dealt with, i'm just keen to see how complex or simple the function would be.
Thanks
Vince