<!DOCTYPE html>
<html>
<body>
<script>
function compu()
{
var n,m=0;
n=parseInt(prompt("Enter the any numbers"));
while(m<=n)
{
alert(m);
m++;
}
}
</script>
<p>Click one of the buttons to call a function</p>
<button onclick="compu()">Click Here</button>
</body>
</html>
Click one of the buttons to call a function
<!DOCTYPE html>
<html>
<body>
<script>
function doloop()
{
var num,x=0,y=1,z;
num=parseInt(prompt("Enter the any number"));
document.write(x+" "+y);
do
{
z=x+y;
document.write(" "+z);
x=y;
y=z;
}
while(z<=(num-x))
}
</script>
<p>Click the button to loop run five times.</p>
<button onclick="help()">Click Here</button>
<p id="demo"></p>
</body>
</html>
Click the button to loop run five times.