Created
April 27, 2022 14:14
-
-
Save MuddyBootsCode/e07850a729adc46c79225537ff1cacdb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function smallestMult(n) { | |
let result; | |
let largest = n; | |
let unsolved = true; | |
while(unsolved === true){ | |
for(let i = 1; i <= largest; i++){ | |
if (largest % i !== 0){ | |
break | |
} else if (i === n){ | |
result = largest; | |
unsolved = false; | |
} | |
} | |
largest += 1; | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment