3/33 Help Anyone


#1

for (i = 0; i <= 20; i++) {
if(i % 3 === 0)
console.log("FizzBuzz")
else if (i % 5 === 0
console.log("FizzBuzz")
else console.log(i)
}
what's wrong with this. Easy instructions.


#3

No this one
for (i = 0; i <= 20; i++) {
if(i % 3 === 0)
console.log("FizzBuzz")
else if (i % 5 === 0)
console.log("FizzBuzz")
else console.log(i)
}


#4

Hey @zoulit! So let me go over this with you since you didnt understand instructions.

First it says print 1-20. Thats preety easy and you got it, it was

for(i=0;i<=20;i++){

}

Now it says if it is divisible by 3 print Fizz if it is divisible by 5 print Buzz and if it is divisble by both print FizzBuzz, else print number. So you didnt do that right. As you only printed FizzBuzz. This is how you implement that to code:

if (i % 3 === 0) {
    console.log("FizzBuzz")
} else if (i % 5 === 0) {
    console.log("FizzBuzz")
} else {
    console.log(i)
}
}

Now you understand? Btw your too young to be in this website.


#5

Well I just fixed my correction thank you. Ant BTW If i got it all the way here i can do everything


#6

Hey possibilities are endless but, Please Check out this post.