JavaScript :- Odd & Even Number (if...else)
This is JavaScript Practical :- Odd & Even Number (if...else).
Script written in small letter because JavaScript Case Sensitive.
Script:-
<html>
<head>
<title>even odd</title>
</head>
<body>
<script type="text/javascript">
//this is a even odd number question.
var n;
n=parseInt(prompt("enter the no."));
if (n % 2 == 0)
{
document.write("even no.");
}
else
{
document.write("odd no.");
}
</script>
</body>
</html>
Save the File .html
Output:-
If you have any doubts mention on the Comment Box.
Please follow the my Blog, Share and Comment.
Comments
Post a Comment