0% found this document useful (0 votes)
25 views3 pages

Javascript Programs Check Odd or Even Using If-Else EX - NO

This JavaScript program uses an if/else statement to check if a user-input number is odd or even. The user is prompted to enter a number, which is then checked using the modulo (%) operator to see if when divided by 2 if there is a remainder (odd) or not (even). An alert window is displayed informing the user if the number is odd or even.

Uploaded by

JAYANTHI B
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views3 pages

Javascript Programs Check Odd or Even Using If-Else EX - NO

This JavaScript program uses an if/else statement to check if a user-input number is odd or even. The user is prompted to enter a number, which is then checked using the modulo (%) operator to see if when divided by 2 if there is a remainder (odd) or not (even). An alert window is displayed informing the user if the number is odd or even.

Uploaded by

JAYANTHI B
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

EX.

NO: JAVASCRIPT PROGRAMS

CHECK ODD OR EVEN USING IF-ELSE

DATE:

AIM:

ALGORITHM:
OUTPUT:
PROGRAM:

<html>

<head>

<title>odd_even</title>

<body>

<script>

var a=window.prompt("enter a number");

if (a%2==0)

{ window.alert(a+" is even number");

else{

window.alert(a+" is odd number");

</script>

</body>

</html>

RESULT:

You might also like