jessicakennedy1028 icon

Bash FizzBuzz

jessicakennedy1028 | PRO | 09/09/18 01:49:09 PM UTC | 0 ⭐ | 378 👁️ | Never ⏰ | []
Bash |

280 B

|

None

|

0 👍

/

0 👎

#!/bin/bash
x=1
while [ $x -le 100 ]; do
    if [[ 0 -eq "($x%3) + ($x%5)" ]]; then
        echo "FizzBuzz"
    elif [[ 0 -eq "($x%5)" ]]; then
        echo "Buzz"
    elif [[ 0 -eq "($x%3)" ]]; then
        echo "Fizz"
    else
        echo "$x"
    fi
    x=$(( $x + 1 ))
done

Comments