Compound Interest Formula

Description: Takes the principle amount, interest rate, number of compoundings per year and the number of years. Returns the total value after N years.
Tested Platform: Visual Studio 2012, 32-bit, Windows 7
Language: C/C++
// Returns the total value of the principle after N years

double compoundInterest(double principle, double interestRate, int compoundingsPerYear, int years) {
	double adjustedInterest = interestRate / 100.0;
	return principle * pow((1.0 + (adjustedInterest / compoundingsPerYear)), compoundingsPerYear * years);

Submitted: February 12, 2014

Return to the snippets listing