aboutsummaryrefslogtreecommitdiff
path: root/debt.pl
blob: 85a1841f14e7d9007874ac28bb7588b8f3bb518c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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);
}