Skip to content

Commit

Permalink
Update fizzBuzz.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Harshitha-Killi committed Apr 30, 2022
1 parent 4a4d35d commit 01ed4af
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions fizzBuzz.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
var output=[];
var count=1;

function fizzbuzz(){
function fizzBuzz(){

if(count%3===0 && count%15!==0){
output.push("Fizz");
}

else if(count%5===0 && count%15!==0){
output.push("Buzz");
}

if(count%3===0 && count%5!==0){
output.push("Fizz");
}
else if(count%15===0){
output.push("FizzBuzz");
}

else if(count%5===0 && count%3!==0){
output.push("Buzz");
}
else{
output.push(count);
}

else if(count%15===0){
output.push("FizzBuzz");
console.log(output);
count++;


}
else{
output.push(count);
}

count++;
console.log(output);

}

0 comments on commit 01ed4af

Please sign in to comment.