Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function test(input) {
  2.     let n = Number(input.shift());
  3.  
  4.     let result = "";
  5.  
  6.     for (let num1 = 1; num1 <= 9; num1++) {
  7.         for (let num2 = 1; num2 <= 9; num2++) {
  8.             for (let num3 = 1; num3 <= 9; num3++) {
  9.                 for (let num4 = 1; num4 <= 9; num4++) {
  10.                     if(n % num1 === 0 && n%num2 ===0 && n%num3 ===0 && n%num4 === 0){
  11.                         result += (`${num1}${num2}${num3}${num4} `);
  12.                     }
  13.                 }
  14.             }
  15.         }
  16.     }
  17.     console.log(result);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement