Published on January 26, 2024By DeveloperBreeze

function calculateCompoundInterest(principal, rate, time) {
    const compoundInterest = principal * Math.pow(1 + rate / 100, time) - principal;
    return compoundInterest;
}
const principalAmount = 1000;
const interestRate = 5;
const timePeriod = 2;
const compoundInterest = calculateCompoundInterest(principalAmount, interestRate, timePeriod);
console.log('Compound Interest:', compoundInterest);

Comments

Please log in to leave a comment.