123456789101112 |
- <head></head>
- <body>
- <script>
- const floors = 9;
- const flats = 4;
- let flatNum = +prompt("Enter flat number");
- let entrance = Math.floor(flatNum / flats / floors);
- let floor = Math.floor((flatNum - (entrance * 36)) / flats);
- alert("Entrance: " + (entrance + 1) + ", Floor: " + (floor+1));
- </script>
- </body>
|