Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tomcha
Created December 4, 2015 01:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomcha/12e01045bd4db9635b11 to your computer and use it in GitHub Desktop.
Save tomcha/12e01045bd4db9635b11 to your computer and use it in GitHub Desktop.
47
#!/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