123456789101112131415161718192021222324252627282930313233 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- <script>
- debugger
- function whereIsMyFlat (flats, floors, flatsIn, yourFlat) {
- var yourEntrance;
- var yourFloor;
- flats = prompt ("How many flats on the each floor?");
- floors = prompt ("How many floors in your house?");
- flatsIn = flats * floors;
- yourFlat = prompt ("Whar is number of your flat?")
- yourEntrance = Math.ceil (yourFlat / flatsIn);
- yourFloor = Math.ceil (yourFlat / flats);
- if (yourFlat <= flatsIn) {
- } else {
- yourFloor = yourFloor % floors;
- if (yourFloor == 0) {
- yourFloor = floors;
- }
- }
- return alert ("You need " + yourEntrance + " entrance and " + yourFloor + " floor.")
- }
- whereIsMyFlat ()
- </script>
- </head>
- <body>
-
- </body>
- </html>
|