blueBelt.html 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. <script>
  8. debugger
  9. function whereIsMyFlat (flats, floors, flatsIn, yourFlat) {
  10. var yourEntrance;
  11. var yourFloor;
  12. flats = prompt ("How many flats on the each floor?");
  13. floors = prompt ("How many floors in your house?");
  14. flatsIn = flats * floors;
  15. yourFlat = prompt ("Whar is number of your flat?")
  16. yourEntrance = Math.ceil (yourFlat / flatsIn);
  17. yourFloor = Math.ceil (yourFlat / flats);
  18. if (yourFlat <= flatsIn) {
  19. } else {
  20. yourFloor = yourFloor % floors;
  21. if (yourFloor == 0) {
  22. yourFloor = floors;
  23. }
  24. }
  25. return alert ("You need " + yourEntrance + " entrance and " + yourFloor + " floor.")
  26. }
  27. whereIsMyFlat ()
  28. </script>
  29. </head>
  30. <body>
  31. </body>
  32. </html>