SHARE
TWEET

Untitled

a guest Jul 19th, 2017 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.     let number = parseInt(num)
  7.  
  8.     for (let i = 0; i < row; i++) {
  9.         result = '';
  10.         for (let j = 0; j < col; j++) {
  11.             if (number % 5 === 0) {
  12.                 number -= first;
  13.             } else if (number % 3 === 0) {
  14.                 number -= second;
  15.             } else {
  16.                 number +=third;
  17.             }
  18.             result += `${number} `;
  19.         }
  20.         console.log(result);
  21.     }
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top