Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function numbers(input) {
- let n = String(input[0]);
- let firstDigit = Number(n[0]);
- let secondDigit = Number(n[1]);
- let thirdDigit = Number(n[2]);
- let rows = firstDigit + secondDigit;
- let columns = firstDigit + thirdDigit;
- let count = rows * columns;
- let output = '';
- while (count > 0) {
- if (n % 5 == 0) {
- n -= firstDigit;
- } else if (n % 3 == 0) {
- n -= secondDigit;
- } else {
- n += thirdDigit;
- }
- count--;
- output += `${n} `;
- }
- console.log(output); // columns * rows????
- }
- numbers([132]);
Advertisement
Add Comment
Please, Sign In to add comment