My 1st Question:-
WAP to input a number and check that number is even number or not.
Tell a program in JAVA Script (Beginners).
Answers
Answered by
0
Explanation:
Even numbers are those numbers that are exactly divisible by 2.
The remainder operator % gives the remainder when used with a number. For example,
const number = 6;
const result = number % 4; // 2
Hence, when % is used with 2, the number is even if the remainder is zero. Otherwise, the number is odd.
PLEASE MARK ME AS BRAINLIEST
Answered by
1
var n = prompt("Enter any number: ");
if (n % 2 == 0) {
console.log("Even number.");
}
else {
console.log("Odd number.");
}
Similar questions
English,
1 day ago
Math,
1 day ago
Social Sciences,
1 day ago
Environmental Sciences,
8 months ago
Geography,
8 months ago