ODD OR EVEN

<html>
<head>
<title>ODD EVEN NUMBERS</title>
<script>
function odev()
{
n=parseInt(frm1.t1.value);
if(n%2==0)
    document.getElementById("res").innerHTML=n+"is even";
else if(n%2!=0)
    document.getElementById("res").innerHTML=n+"is odd";
else
    document.getElementById("res").innerHTML=n+"is neither positive neither negative";

}
</script>
</head>
<style>
body{
color:green;
margin:100px 100px 100px 100px;
padding:50px;
border:10px dotted green;
border-radius:100px;
background-color:red;
}

</style>
<body>
<form name=frm1>
Number :<input type=text name=t1></br>
<input type=button value="ODD OR EVEN" onclick="odev()"></br>
<span id="res">Check</span>
</form>
</body>
</html>

Comments

NR Classes said…
Yes correct...
but that else part in the script will never execute..

Arin you are a good coder at this age ...Keep it up
Anya Bansal said…
This comment has been removed by the author.

Followers

Popular posts from this blog

Arin Bansal: For loop