Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

Commit

Permalink
Create FizzBuzz_function.sh
Browse files Browse the repository at this point in the history
Fizz Buzz Program using function in bash scripts.
  • Loading branch information
Vibe30 authored Oct 3, 2020
1 parent 32396dc commit cfdd108
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Bash/FizzBuzz_function.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// FizzBuzz Using Functions in Bash
// Author: @Vibe30

#!/bin/bash

x=0
Fizzbuzz() { (! (( x % 3 )) ) && (! ((x % 5)) ) && echo "Fizzbuzz"; }
Fizz() { (! (( $x % 3 )) ) && echo "Fizz"; }
Buzz() { (! (( $x % 5 )) ) && echo "Buzz"; }


while ((x < 101 ))
do

Fizzbuzz $x || Fizz $x || Buzz $x || echo $x

((x++))
done

0 comments on commit cfdd108

Please sign in to comment.