Created
February 20, 2013 06:06
-
-
Save toya33/4993318 to your computer and use it in GitHub Desktop.
1. shと標準的なコマンド群を用いて評価可能なFizzBuzzシェルスクリプトFizzBuzz1.shを作成する。数え上げる数値は1以上100以下の整数100個とする。(20点)
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
#!/bin/sh | |
#1から100まで数え上げる | |
for i in `seq 1 100` | |
do | |
if [ `expr $i % 15` -eq 0 ]; then | |
echo "FizzBuzz " | |
elif [ `expr $i % 3` -eq 0 ]; then | |
echo "Fizz " | |
elif [ `expr $i % 5` -eq 0 ]; then | |
echo "Buzz" | |
else | |
echo "$i " | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment