Answers for "hackerrank.com fizzbuzz javascript"

1

hackerrank fizzbuzz javascript

for (i=1; i<=100; i++) {
    console.log((i%3==0&&i%5==0)?"FizzBuzz":(i%3==0)?"Fizz" : (i%5==0)?"Buzz" : i);
}
Posted by: Guest on April-07-2020
0

hackerrank.com fizzbuzz javascript

function fizzBuzz(n) {
    // Write your code here
    for(let i = 1;  i <= n; i++) {
        
         if(i % 3 == 0 && i % 5 == 0) {
            console.log('FizzBuzz')
       }
       else if(i % 3 == 0) {
           console.log('Fizz')
       } else if(i % 5 == 0) {
            console.log('Buzz')
       } else {
            console.log(i)
      }
    }
}
Posted by: Guest on October-28-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language