Created
March 23, 2024 16:18
-
-
Save yaasita/1034d36b159250b42cd17ccfaf72037c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use feature qw(:5.10); | |
use utf8; | |
my @box; | |
$box[$_] = 10 for 1..30; | |
for my $student (1..30){ | |
for (1..30){ | |
if ($_ % $student == 0){ | |
$box[$_]--; | |
} | |
} | |
} | |
# question1 | |
my $q1; | |
for(1..30){ | |
if ($box[$_] == 8){ | |
$q1++; | |
} | |
} | |
say $q1; | |
# question2 | |
my $q2; | |
for(1..30){ | |
if ($box[$_] % 2 == 0){ | |
$q2++; | |
} | |
} | |
say $q2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment