Skip to content

Instantly share code, notes, and snippets.

@yaasita
Created March 23, 2024 16:18
Show Gist options
  • Save yaasita/1034d36b159250b42cd17ccfaf72037c to your computer and use it in GitHub Desktop.
Save yaasita/1034d36b159250b42cd17ccfaf72037c to your computer and use it in GitHub Desktop.
#!/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