Create a gist now

Instantly share code, notes, and snippets.

When sum of all multiplation table numbers is subtracted 9, its answer is 2016.
#!/usr/bin/perl
use strict;
use warnings;
my $sum = 0;
for my $i (1..9) {
for my $j (1..9) {
$sum += $i * $j;
}
}
$sum -= 9;
print "sum = $sum\n";
__END__
$ perl 99sum.pl
sum = 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment