Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>ex1.loops</title>
- </head>
- <body>
- <script>
- /*
- var num1 = parseFloat(prompt("enter a number between 1 and 10 (1 and 10 included)"));
- while(num1 > 10 || num1 < 1)
- {
- document.write("The value entered is not valid. Please try again since" + num1 + " is not between 1 and 10");
- num1 = parseFloat(prompt("Enter a number between 1 and 10 (1 and 10 included)"));
- }
- document.write("Thank you! The number you entered, "+ num1 +" is between 1 and 10.");
- */
- var num = parseFloat(prompt("Please enter a number between one and ten!"));
- while(num < 1 || num > 10)
- {
- alert("Sorry! The number you entered, " + num + ", is not between one and ten. Please try again!");
- }
- alert("Thank you! The value you entered, " + num + ", is between one and ten!");
- </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment