Skip to content

Instantly share code, notes, and snippets.

@AzureKitsune
Last active August 29, 2015 13:57
Show Gist options
  • Save AzureKitsune/910c0006391a1ec32be4 to your computer and use it in GitHub Desktop.
Save AzureKitsune/910c0006391a1ec32be4 to your computer and use it in GitHub Desktop.
Print Factors
function printPossibleFactors(number, maxNumber) {
for(var i = 0; i < maxNumber; i++) {
if ((number/i) == Math.round(number/i)) {
console.log(number/i + " * " + i + " | Sum: " + ((number/i) + i));
}
}
}
printPossibleFactors(40, 100); //get all factors for 40 up to 100.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment