Advertisement
Spocoman

03. Lucky Numbers

Jan 1st, 2022
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function luckyNumbers(input) {
  2.     let num = Number(input);
  3.     let print = '';
  4.     for (let i = 1; i <= 9; i++) {
  5.         for (let k = 1; k <= 9; k++) {
  6.             for (let j = 1; j <= 9; j++) {
  7.                 for (let x = 1; x <= 9; x++) {
  8.                     if (i + k === j + x && num % (i + k) === 0) {
  9.                         print += `${i}${k}${j}${x} `;
  10.                     }
  11.                 }
  12.             }
  13.         }
  14.     }
  15.     console.log(print.trimEnd());
  16. }
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement