Skip to content

Instantly share code, notes, and snippets.

@xtetsuji
Created January 11, 2017 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xtetsuji/0087667d148eb3cdac712a1017df7aa3 to your computer and use it in GitHub Desktop.
Save xtetsuji/0087667d148eb3cdac712a1017df7aa3 to your computer and use it in GitHub Desktop.
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