ProdanTenev

Building

Mar 2nd, 2022 (edited)
959
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 0.51 KB | None | 0 0
  1. function building(input) {
  2.     let floors = Number(input[0]);
  3.     let rooms = Number(input[1]);
  4.    
  5.     for (let f = floors; f >= 1; f--) {
  6.         let output = "";
  7.         for (let r = 0; r < rooms; r++) {
  8.             if (f === floors) {
  9.                 output += "L" + f + r + " ";
  10.             } else if (f % 2 === 0) {
  11.                 output += "O" + f + r + " ";
  12.             } else {
  13.                 output += "A" + f + r + " ";
  14.             }    
  15.         }
  16.         console.log(output.trim());
  17.     }
  18. }
Add Comment
Please, Sign In to add comment