Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript How to print every number that is divisible by either 3 or 5, but not both

const threeOrFive = max => {
    const store = [];

    for(let i = 0; i < max; i++){
        if (i%3==0 && i%5==0) continue;
        else if (i%3==0) store.push(i);
        else if (i%5==0) store.push(i);
    }

    return store;
}
 
PREVIOUS NEXT
Tagged: #javascript #How #print #number #divisible
ADD COMMENT
Topic
Name
9+6 =