Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- let n = Number(input[0]);
- let output = "";
- for (let i = 1111; i <= 9999; i++) {
- let numberAsString = i.toString();
- for (let index = 0; index < numberAsString.length; index++) {
- let currentNum = Number(numberAsString[index]);
- if (i % currentNum !== 0) {
- break;
- }
- if (index === 3 && i % currentNum === 0) {
- output += i + " ";
- }
- }
- }
- console.log(output);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement