Skip to content

Instantly share code, notes, and snippets.

@bryancodesjs
Last active January 20, 2022 04:28
Show Gist options
  • Save bryancodesjs/e014057f8f1d14a12ca084f565da6339 to your computer and use it in GitHub Desktop.
Save bryancodesjs/e014057f8f1d14a12ca084f565da6339 to your computer and use it in GitHub Desktop.
Count from 1 to 100 and print a message every time a multiple of 3 or 5 is found.
function findMultiples() {
let baseNumer = 0;
for(let i = 0; i<100 ; i++) {
baseNumer ++;
console.log(baseNumer);
if(baseNumer % 3 == 0) {
console.log('multiple of 3 found');
} else {
if (baseNumer % 5 == 0) {
console.log('multiple of 5 found');
}
}
}
}
findMultiples();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment