Page 1 of 1

% calculation

Posted: Mon Sep 03, 2007 4:59 pm
by SirChick
How do u structure a sentence so say you had:

$value: 10
$percentage : 2

So i want to get 2% of 10 then add that % on to 10...

Posted: Mon Sep 03, 2007 5:03 pm
by VladSun
;)
[math]
new_value = old_value * (1 + percentage/100)
[/math]

Posted: Mon Sep 03, 2007 5:21 pm
by SirChick
explain that 1+ part i dont understand that bit :S

Posted: Mon Sep 03, 2007 5:26 pm
by VladSun
100% = 1

1 + (2%) = 100% + 2% = 102%

102% = 1.02 = 1 + 0.02 = 1 + 2/100