hw08_03_!Flats.html 565 B

1234567891011121314151617
  1. <header>
  2. <h1>Flats</h1>
  3. </header>
  4. <body>
  5. <script>
  6. const padikNum = (flatNum, floors = 9, flats = 4) => {
  7. let entrance = Math.floor(flatNum / flats / floors) + 1;
  8. //let floor = Math.floor((flatNum - (entrance * 36)) / flats) + 1; использовал при отладке
  9. return { entrance, floor };
  10. }
  11. let flatNum = +prompt("Enter flat number");
  12. let padikDef = padikNum(flatNum);
  13. alert("Entrance: " + (padikDef.entrance) + ", Floor: " + (padikDef.floor));
  14. </script>
  15. </body>