How to solve the problem with “do…while” function,
if i have data like this,
taxbefore= 2000
taxvalue= 0.02
how to get taxafter with “do…while” function?
taxbefore | | taxafter |
2000 | 40 | 0.8 | 0.016 | 2040.816 |
formula> | (20000.02) = 40 | (400.02) = 0.8 | (0.8*0.02) = 0.016 | =sum(2000+40+0.8+0.016) |
thank you
best regards
edo
Hi Edo Mas Suryatmo,
Please try the below code. Please give a value to the condition.
The main purpose of the do while is, it will run atleast once. So, atleast it will return 2040.00 value.
real taxBefore, taxAfter, taxValue, conditionValue;
;
taxBefore = 2000;
taxAfter = taxBefore;
taxValue = 0.02;
do
{
taxAfter += taxAfter * taxValue;
}
while (conditionValue < taxAfter);
Please refer this URL http://msdn.microsoft.com/en-us/library/aa842320.aspx
Thanks,
Hari