Calculate total value along sequence based on fix percentage and sequence

Clash Royale CLAN TAG#URR8PPPCalculate total value along sequence based on fix percentage and sequence
So I know how to do this using a function on any given programming language but I wonder how to do it with a formula. This is to calculate the price of a item in a game. The item cost initially 200 but once the user buys it, its price gets incremented a 20% so now cost 240 and it will cost 288 the very next time as it is a 20% increment from the last price. What if I want to calculate the price based on the sequence, lets say the item is on level 12 (has been bought or upgraded 11 times), what is the formula to calculate the price without using a loop (storing the previous value) but based only on the current level (12), the base price (200) and the fix percentage (20%)?
1 Answer
1
const price = (1+percent)**(level-1) * initialPrice
Basic compound interest formula :-)
(** is the power operator)
**
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.