Guest User

Untitled

a guest
Aug 6th, 2020
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. function solve(input) {
  2. let n = Number(input[0]);
  3. let output = "";
  4. for (let i = 1111; i <= 9999; i++) {
  5. let numberAsString = i.toString();
  6. for (let index = 0; index < numberAsString.length; index++) {
  7. let currentNum = Number(numberAsString[index]);
  8. if (i % currentNum !== 0) {
  9. break;
  10. }
  11. if (index === 3 && i % currentNum === 0) {
  12. output += i + " ";
  13. }
  14. }
  15. }
  16. console.log(output);
  17. }
Advertisement
Add Comment
Please, Sign In to add comment