Advertisement
Guest User

Untitled

a guest
Jul 19th, 2017
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. function solve(num) {
  2. let [first,second,third] = num.toString().split('').map(Number);
  3. let row = first + second;
  4. let col = first + third;
  5. let result = '';
  6.  
  7. for (let i = 0; i < row; i++) {
  8. result = '';
  9. for (let j = 0; j < col; j++) {
  10. if (num % 5 === 0) {
  11. num -= first;
  12. } else if (num % 3 === 0) {
  13. num -= second;
  14. } else {
  15. num += third;
  16. }
  17. result += ` ${num}`;
  18. }
  19. console.log(result);
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement