Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(num) {
- let [first,second,third] = num.toString().split('').map(Number);
- let row = first + second;
- let col = first + third;
- let result = '';
- for (let i = 0; i < row; i++) {
- result = '';
- for (let j = 0; j < col; j++) {
- if (num % 5 === 0) {
- num -= first;
- } else if (num % 3 === 0) {
- num -= second;
- } else {
- num += third;
- }
- result += ` ${num}`;
- }
- console.log(result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement