3. ...And the good!


#1

Print out the numbers from 1 - 20. The rules: For numbers divisible by 3, print out "Fizz". For numbers divisible by 5, print out "Buzz". For numbers divisible by both 3 and 5, print out "FizzBuzz" i. Otherwise,print number


Rif(i%3===0||i%5===0){
        if(i%3===0 && i%5!=0){
        console.log("Fizz");
        }
        else if(i%3!=0 && i%5===0){
            console.log("Buzz");
            }
            else {
                console.log("FizzBuzz");
                }
    };
    else {
        console.log(i);
        }
    
    
    };


#2

r is only cut copy mistake


#3

Alright, you've got a lot of mistakes here, let's begin.

Over here is where you should have your for loop

You almost got it right here, but it should be like this: i % 3 === 0 && i % 5 !== 0 But you'll be fine if you have only the i % 3 === 0

You got this wrong as well, but I would like you to solve this one yourself looking at how I told you to fix the other.

Over here, the fizzbuzz should be if it is both divisible by 3 and 5, so you need another else if.


#4

Ola,amigo tente isso!
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");
}


#5

Ola,amigo tente isso!
if(i%3===0 && i%5===0){
console.log("FizzBuzz");
}else if(i%3===0){
console.log("Fizz");
}else if(i%5===0){//corrigi soi mal!
console.log("Buzz");
}


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.