+ 1

# How to crate a code for compound interest?

2 Answers

+ 3

for (int x = 0; x < years; x++)
{
money *= 1.02
// For two percent interest rate
}

+ 1

Yup, basic maths. To add or subtract a percentage of a number to itself:
Positive percentage,
Money * (1 + (<Percentage> / 100)
Negative percentage,
Money * (1 - (<Percentage> / 100)