Skip to content

Instantly share code, notes, and snippets.

@tomcha
Created December 1, 2015 09:38
Show Gist options
  • Save tomcha/3139e85a5a74295b44e2 to your computer and use it in GitHub Desktop.
Save tomcha/3139e85a5a74295b44e2 to your computer and use it in GitHub Desktop.
32
#!/usr/bin/env perl
use strict;
use warnings;
my $i= 0;
print "1~100の数字を入力して下さい。>>>";
$i = <STDIN>;
chomp $i;
if ($i % 2 == 0 && $i >= 51){
print "51以上の偶数\n";
}elsif ($i % 2 == 0 && $i <= 50){
print "50以下の偶数\n";
}elsif ($i >= 51){
print "51以上の奇数\n";
}elsif ($i < 50){
print "50以下の奇数\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment