Skip to content

Instantly share code, notes, and snippets.

@nogajun
Created November 16, 2012 14:59
Show Gist options
  • Save nogajun/4087948 to your computer and use it in GitHub Desktop.
Save nogajun/4087948 to your computer and use it in GitHub Desktop.
Himeji IT Study Vol.11 L-1 GP 1. FizzBuzz
#!/bin/bash
fizzbuzz(){
NUM=""
(($1 % 3 == 0)) && NUM=${NUM}Fizz
(($1 % 5 == 0)) && NUM=${NUM}Buzz
[ ! ${NUM} ] && NUM=$1
echo ${NUM}
}
for i in {1..100};do fizzbuzz ${i};done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment