Computer Science, asked by dfathima78, 3 months ago

write a javascript program to display the numbers divisible by 2 and 5 which range between 1 and 100 using for loop.
HELP ASAP.

Answers

Answered by utsavsinghal
2

Answer:

let output = "" 

for(let i = 0; i <= 100; i++) { 

// if dividing i by 3 and 5 yields remainder of zero 

// number is divisible by both 3 and 5 

if(i % 3 == 0 && i % 5 == 0) { 

output += i + " Fizz-Buzz, " 

// else if number is divisible only by 3 

} else if(i % 3 == 0) {  

output += i + " Fizz, " 

// else if number is divisible only by 5 

} else if(i % 5 == 0) { 

output += i + " Buzz, " 

console.log(output) 

// 3 Fizz, 5 Buzz, 6 Fizz, 9 Fizz, 10 Buzz, 12 Fizz, 15 Fizz-Buzz etc 

Explanation:

Mark me as Brainliest

Similar questions