This javascript generates the number of odd numbers between 1 & 100.
Following is the javascript for the same:-
<html>
<head>
<title>Odd Nos</title>
</head>
<body>
<script language="javascript" type="text/javascript">
var i,count=0;
for(i=0;i<100;i++)
{
if(i%2!=0)
{
count++;
}
document.write("No of odd nos bet'n 1 & 100 is : "+count);
}
</script>
</body>
</html>
Following is the javascript for the same:-
<html>
<head>
<title>Odd Nos</title>
</head>
<body>
<script language="javascript" type="text/javascript">
var i,count=0;
for(i=0;i<100;i++)
{
if(i%2!=0)
{
count++;
}
document.write("No of odd nos bet'n 1 & 100 is : "+count);
}
</script>
</body>
</html>
No comments:
Post a Comment