Write a program that asks the user for a number and then counts up from 0 to that number using a while loop || Javascript example ||

 



<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Write a program that asks the user for a number and then counts up from 0 to that number using a while loop.
    </title>
</head>
<body>
    <script>

  let result=parseInt (prompt("enter a number"));
  let count=0;
 while(count <= result)
{
    console.log(count)
count++;
 }




    </script>
</body>
</html>
Next Post Previous Post
No Comment
Add Comment
comment url
We detected that you're using an AdBlocker. Please disable it and refresh to continue using our website.
Ad