#!/usr/bin/env perlusestrict;usewarnings;# Perl入学式 2018 第2回 復習問題# https://github.com/perl-entrance-org/workshop-2018/blob/master/2nd/practice.md# 復習問題(even_or_odd.pl)# 標準入力により数値を一つ読み込み, その数値が偶数なら"even", 奇数なら"odd" という文字を出力するeven_or_odd.plを作成しようprint"INPUT some number > ";my$input=<STDIN>;chomp$input;if($input%2==0){print"$input is even\n";}else{print"$input is odd\n";}
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.