Monday, December 10, 2012

FD RD Computation for LIC t.no.75 policy

<?php
$premium = 1000;
$rate = 0.05;
$years = 20;

echo "RD = ".rd($premium,$rate,$years)."\n";
$fd1 = fd(3000,0.05,15);
$fd2 = fd(3000,0.05,10);
$fd3 = fd(3000,0.05,5);

$fd4 = 22000;
echo "FD = ".($fd1+$fd2+$fd3+$fd4)."\n";


function fd($amt,$rate,$years) {
        for($i=0; $i<$years;++$i) {
                $amt = $amt*(1+$rate);
        }
        return $amt;
}

function rd($amt,$rate,$years) {

        $final = 0;
        for($i=0; $i<$years;++$i) {
                $final = ($final + $amt)*(1+$rate);
        }
        return $final;
}
?>

No comments:

Blog Archive