What would a compound interest formula look like coded in PHP? The Compound Inte
ID: 3749182 • Letter: W
Question
What would a compound interest formula look like coded in PHP?
The Compound Interest Formula is: = (1 + )
Where P = principal amount (the initial amount you borrow or deposit) r = annual rate of interest (as a decimal) t = number of years the amount is deposited or borrowed for. A = amount of money accumulated after n years, including interest. n = number of times the interest is compounded per year
Example: An amount of $1,500.00 is deposited in a bank paying an annual interest rate of 4.3%, compounded quarterly. What is the balance after 6 years?
Explanation / Answer
FORMULA for compound Interest = A = P (1 + r/n) (nt)
<?php
$cpy=2; // No. of times compound interest per year
$n=7; // Year
$p=50; // Principal
$ir=20; // Interest Rate
$dd = 1+(($ir/$cpy)/100); //ci = p * (1 + ir/cpy)^(cpy*n)
$ci = $p*pow($dd,$cpy*$n);
echo "Compount interest : ".$ci;
?>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.