Check whether number is Even or Odd using HTML and JAVASCRIPT
Program:
<html> | |
<head> | |
<script type="text/javascript"> | |
function greater() | |
{ | |
var a=prompt("enter one no:"); | |
if(a%2==0) | |
{ | |
document.write("even number"); | |
} | |
else | |
{ | |
document.write("odd number"); | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<input type="button" onclick="greater()" value="click here to find out whether number is even or odd"> | |
</body> | |
</html> |
OUTPUT:
Click Button and Enter Number
See The OUTPUT
No comments:
Post a Comment