Skip to content

Instantly share code, notes, and snippets.

@lebrancconvas
Created February 7, 2022 14:03
Show Gist options
  • Save lebrancconvas/216fbfb22154fccf83257feb2f278630 to your computer and use it in GitHub Desktop.
Save lebrancconvas/216fbfb22154fccf83257feb2f278630 to your computer and use it in GitHub Desktop.
const number = [1,2,3,4,5,6,7,8,9];
const number1 = [1,2,3,4,5,6,7,8,9,10,11,12];
let answer = "";
let setanswer = [];
number.map(a => {
number.map(b => {
number.map(c => {
number.map(d => {
if(a*b+c-d === 12) {
if(a !== b && a !== c && a !== d && b !== c && b !== d && c !== d) {
if(true)
answer = `${a} - ${b} - ${c} - ${d}`;
setanswer.push(answer);
}
}
})
})
})
})
setanswer.map(x => {
console.log(x + "\n");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment