Search Your Project Here Please

Write a javascript code to check whether the number is even or odd.


Write a javascript code to check whether the number is even or odd.

a.    <html>
b.    <head>
c.    <script type="text/javascript">
d.    var n = prompt("Enter a number to find odd or even", "Type your number here");
e.    n = parseInt(n);
f.    if (isNaN(n))
g.    {
h.    alert("Please Enter a Number");
i.    }
j.    else if (n == 0)
k.    {
l.    alert("The number is zero");
m.    }
n.    else if (n%2)
o.    {
p.    alert("The number is odd");
q.    }
r.    else
s.    {
t.    alert("The number is even");
u.    }
v.    </script>
w.    </head>
x.    <body>
y.    </body>
z.    </html>

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...