A compound interest calculator web app built with ReactJS.
function compoundInterest(p, r, n, t, c, cn) {
let total = p;
let principal = p;
for (let i = 0; i < t * n; i++) {
total += (c * cn) || 0;
total = total + (total * r);
principal += (c * cn) || 0;
}
return { total, principal };
}