From 2300d2813a524cbfeabac794335e7abe99263df6 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 29 Dec 2015 23:10:50 -0500 Subject: initial commit --- debt.pl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 debt.pl (limited to 'debt.pl') diff --git a/debt.pl b/debt.pl new file mode 100644 index 0000000..85a1841 --- /dev/null +++ b/debt.pl @@ -0,0 +1,17 @@ +#!/usr/bin/perl -w + +my $debt = shift || 1000; +my $idebt = $debt; + +my $months = shift || 100; +for(1..$months) { + $debt += $debt * 0.1; + if($idebt > 16) { + $idebt += (($idebt >> 4) + ($idebt >> 5) + ($idebt >> 7) - ($idebt >> 9)); + } else { + $idebt++; + } + # print "$debt\t$idebt\n"; + $pct = $idebt * 100 / $debt; + printf("%.2d\t$idebt\t%.1d%%\n", $debt, $pct); +} -- cgit v1.2.3