Last active
November 1, 2022 09:59
-
-
Save jonathanbcsouza/8d32e9781313be9bc9985f298b1e612b to your computer and use it in GitHub Desktop.
Multipliers Finder
This file contains hidden or 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
// Return all sets of two numbers, that multiplied by each other, result in 18 | |
const sub_array = []; | |
const super_array = [2, 5, 7, 12, 3, 4, 13, 9, 1, 6]; | |
for (let i = 0; i < super_array.length; i++) { | |
for (let j = 0; j < super_array.length; j++) { | |
if (super_array[i] * super_array[j] == 18) { | |
sub_array.push([super_array[i], super_array[j]]); | |
} | |
} | |
} | |
console.log(sub_array); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment