May 25, 2023
Program to use Even and Odd Numbers in JavaScript Language
let a = 13;
if (a % 2 == 0) {
console.log("Number is Even");
} else {
console.log("Number is Odd");
}
Output
Number is Odd
Steps Description
- Declare variable
a
- Initialize variable with value of 13
a=13
- if statement
a
Modulus2
equal to0
is even number - else statement is odd number
console.log
inbuild function to displaya
variable
by : Suhel Akhtar
Quick Summary:
An even number is a number which when divided by 2 gives 0 is called an even number.
say 2, 4, 6, 8, 10, 12, 14, 16, 100 and
An odd number is a number which when divided by 2 does not give 0 is called an Odd number.
3,5,7,9,11, 13, 15, 17, 99;