diff options
| -rwxr-xr-x | challenge-276/kai-burgdorf/perl/ch-1.pl | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/challenge-276/kai-burgdorf/perl/ch-1.pl b/challenge-276/kai-burgdorf/perl/ch-1.pl new file mode 100755 index 0000000000..2385b6b6d3 --- /dev/null +++ b/challenge-276/kai-burgdorf/perl/ch-1.pl @@ -0,0 +1,23 @@ +#!/usr/bin/perl + +#@hours = (12, 12, 30, 24, 24); +@hours = (72, 48, 24, 5); + +my $paircounter = 0;; +my $i = 0; + +foreach( @hours ) { + my $j = 0; + my $firstSummand = $_; + foreach( @hours ) { + if( $j>$i && (($firstSummand + $_) % 24) == 0) { + $paircounter++; + print "Pair $paircounter: ($firstSummand, $_)\n"; + } + $j++; + }; + $i++; +} + +print "Output: $paircounter\n"; + |
