Created
December 4, 2015 01:28
-
-
Save tomcha/12e01045bd4db9635b11 to your computer and use it in GitHub Desktop.
47
This file contains 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/env perl | |
use strict; | |
use warnings; | |
my @num; | |
@num = (1..1000); | |
my @rev_num = reverse @num; | |
for my $i (0..999){ | |
my $sum = $num[$i] + $rev_num[$i]; | |
if ($sum == 1001){ | |
print "$i => ok\n"; | |
}else{ | |
print "$i番目の要素の合計は$sumです。\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment