generated from jmug/nix-go-starter
19 lines
No EOL
489 B
Bash
Executable file
19 lines
No EOL
489 B
Bash
Executable file
#!/etc/profiles/per-user/jmug/bin/zsh
|
|
|
|
# FizzBuzz implementation
|
|
# Prints numbers from 1 to 15
|
|
# For multiples of 3, print "Fizz" instead of the number
|
|
# For multiples of 5, print "Buzz" instead of the number
|
|
# For multiples of both 3 and 5, print "FizzBuzz"
|
|
|
|
for i in {1..15}; do
|
|
if (( i % 3 == 0 && i % 5 == 0 )); then
|
|
echo "FizzBuzz"
|
|
elif (( i % 3 == 0 )); then
|
|
echo "Fizz"
|
|
elif (( i % 5 == 0 )); then
|
|
echo "Buzz"
|
|
else
|
|
echo $i
|
|
fi
|
|
done |