Skip to content

Commit

Permalink
Upd
Browse files Browse the repository at this point in the history
  • Loading branch information
EvelinaVinnikova committed Oct 4, 2024
1 parent 510ba52 commit 06551e2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions solution/fizzbuzz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ n="$1"

for ((i=1; i<=n; i++)); do
output=""

if (( i % 3 == 0 )); then
output+="Fizz"
fi

if (( i % 5 == 0 )); then
output+=" Buzz"
output+="Buzz"
fi

if [[ -z "$output" ]]; then
output="$i"
else
output+=" "
fi

printf "%s\n" "$output"
done

0 comments on commit 06551e2

Please sign in to comment.