summaryrefslogtreecommitdiffstats
path: root/009.pl
blob: 73cafeb435bc9078ed8d841acd2ea9f5699aa774 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/perl
use strict;
use warnings;

A: for my $a (1..1000) {
    B: for my $b (1..(1000 - $a)) {
        my $c = 1000 - $a - $b;
        next A if $c <= 0;
        if ($a**2 + $b**2 == $c**2) {
            print "$a, $b, $c: ", $a * $b * $c, "\n";
            last A;
        }
    }
}