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