ibvasi
4/6/2017 - 9:50 PM

Check if a number is divisible by 3 or 5

Check if a number is divisible by 3 or 5

function checkDivisibility() {
    for (var i = 1; i <= 100; i++) {
        if (i % 3 === 0) {
            console.log(i + " " + "is divisible by 3");
        } else {
            console.log(i + " " + "is not divisible by 3");
        }
        if (i % 5 === 0) {
            console.log(i + " " + "is divisible by 5");
        } else {
            console.log(i + " " + "is not divisible by 5");
        }
    }
}
checkDivisibility();