-5

Use a for loop to go through all numbers from number up to 50 (both inclusive), and check if they are multiples of 3. If they are, print them.

for(var number = 42; number <= 50; number++)


   while (number % 3 == 0 ){
       console.log(number);
       break;
   } 

I don't know what my if statement should be.

Kristianmitk
  • 4,528
  • 5
  • 26
  • 46

1 Answers1

0
for(var number = 0; number <= 50; number++)
    if (number % 3 == 0 ){
       console.log(number);
   }

a while-loop is not the way you are looking for. use an if-statement and remove the break to continue iterating the for loop

itsofirk
  • 32
  • 3