Sunday, August 26, 2012

Comparing weight with short code in javascript


<html>
<body>
<head>
<script type="text/javascript">
function odd(st,end)
{
while(st<=end)
{
if(st % 2 == 1)
document.write("The number "+st+ " is a odd number<br/>");
st=st+1;
}
}
a=parseInt(prompt("Enter starting number","2"));
b=parseInt(prompt("Enter ending number","12"));
odd(a,b);
</script>
</head>
</body>
</html>

No comments:

Post a Comment