Advertisement
Guest User

Fizzbuzz

a guest
Apr 6th, 2020
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. This is my solution to the "FizzBuzz" problem:
  2.  
  3. for (i = 1; i < 101; i++) {
  4.     if ((i % 3 == 0) && (i % 5 == 0)) {
  5.         console.log("FizzBuzz");
  6.     } else if (i % 3 == 0) {
  7.         console.log("Fizz");
  8.     } else if (i % 5 == 0) {
  9.         console.log("Buzz");
  10.     } else {
  11.         console.log(i)
  12.     }
  13.     }
  14.  
  15. // Replace console.log with print if you're running this outside of Node
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement