aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Burgdorf <k@iburgdorf.de>2024-07-04 23:39:24 +0200
committerKai Burgdorf <k@iburgdorf.de>2024-07-04 23:39:24 +0200
commitea2581d07013cb743fa95f0537a7da9b38d7e7e6 (patch)
treead622a5dc76ea7355113138ba89b49b6266a823f
parent47f02351c5d3732ede2943cbe418bf33e4813077 (diff)
downloadperlweeklychallenge-club-ea2581d07013cb743fa95f0537a7da9b38d7e7e6.tar.gz
perlweeklychallenge-club-ea2581d07013cb743fa95f0537a7da9b38d7e7e6.tar.bz2
perlweeklychallenge-club-ea2581d07013cb743fa95f0537a7da9b38d7e7e6.zip
ch-1 perl solution
-rwxr-xr-xchallenge-276/kai-burgdorf/perl/ch-1.pl23
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";
+