>Here is probably a simple math problem but I seem to have a mental block:
>
>I want to reduce any given number to zero in 10 steps or loops. In each loop iteration I only have access to the previous value, not the initial starting value. I was thinking of subtracting a percentage off the previous value but that will not reduce to zero in 10 steps especially given that the number can have up to 4 decimals. Any obvious solution?
>
>Update: I also cannot know what iteration I am on. In other words, I want to reduce a number by some formula and know that within +/-10 iterations the number will fall to zero.
Dunno Jos, but wouldn't the step value be (InitialValue / 10) ?
If the number is not 'easily' divided by 10, ie (InitialValue / 10) * 10 != InitialValue, you could always populate a Collection with the first 9 values and the tenth value would be InitialValue - first 9 stepvalues
I would go for the collection approach regardless. You feed the collection and loop - removing one item at a time - until it's empty
Gregory