B
boblehue
Hi
I'm tryng to learn a little perl and have a problems with decimal's.
This asignment is to rewrite this code to not print more the two decimals
with the use of INT operator, multiplication, and division.
print "Monthly deposit amount? ";
$pmt=<STDIN>;
chomp $pmt;
print "Annual Interest rate? (ex. 7% is .07) ";
$interest=<STDIN>;
chomp $interest;
print "Number of months to deposit? ";
$mons=<STDIN>;
chomp $mons;
# Formula requires a monthly interest
$interest/=12;
$total=$pmt * ( ( (1 + $interest) ** $mons ) -1 )/ $interest;
print "After $mons months, at $interest monthly you\n";
print "Will have $total,\n";
Regards
Boblehue
I'm tryng to learn a little perl and have a problems with decimal's.
This asignment is to rewrite this code to not print more the two decimals
with the use of INT operator, multiplication, and division.
print "Monthly deposit amount? ";
$pmt=<STDIN>;
chomp $pmt;
print "Annual Interest rate? (ex. 7% is .07) ";
$interest=<STDIN>;
chomp $interest;
print "Number of months to deposit? ";
$mons=<STDIN>;
chomp $mons;
# Formula requires a monthly interest
$interest/=12;
$total=$pmt * ( ( (1 + $interest) ** $mons ) -1 )/ $interest;
print "After $mons months, at $interest monthly you\n";
print "Will have $total,\n";
Regards
Boblehue