1
$\begingroup$

I'll make this short as this is a silly question.

I have a number say 500. And a number n, which represents how many times I apply to my first number a transformation(add 20% to current value). This means if n=1 the result will be 500+500*20/100=600. If n=2 the result will be 600+600*20/100=720 and so on.

Now thing is I am a proggramer and it's easy to create a for loop to calculate this, but I'm guessing there has gotta be a faster way to it, like with a formula. Hope this makes sense.

Any help is appreciated.

1 Answers 1

2

Adding $20$% to a number is the same as multiplying the number by $1.2$, so the result of doing it $n$ times to the number $x$ is simply $(1.2)^nx$, where $x$ is the original number.

  • 0
    Thanks this was what I was looking for. It wasn't complicated but for some reason the answer eluded me ;)2012-04-27