amp-blog-agent/fizzbuzz.sh
jmug 68907b427f That was fun!
Signed-off-by: jmug <u.g.a.mariano@gmail.com>
2025-07-31 09:12:53 -07:00

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