index.html 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <title>Document</title>
  8. </head>
  9. <body>
  10. <script>
  11. let CaloriesPerDay = 2000;
  12. let CaloriesPerMeal = prompt(
  13. "Введите, сколько калорий вы потребили:"
  14. );
  15. if (CaloriesPerMeal < CaloriesPerDay) {
  16. let CalorieDifference = CaloriesPerDay - CaloriesPerMeal;
  17. alert(
  18. "Вы ещё можете употребить: " +
  19. CalorieDifference +
  20. " калорий. Мало есть тоже плохо!"
  21. );
  22. } else {
  23. let CalorieDifference = CaloriesPerDay - CaloriesPerMeal;
  24. alert(
  25. "Вы превысили лимит калорий в сутки на: " +
  26. CalorieDifference +
  27. "." +
  28. " Хватит жрать!"
  29. );
  30. }
  31. </script>
  32. </body>
  33. </html>