Computer Science, asked by snehadivyanshu123, 2 days ago

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 aryantejaswipati
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 atrs7391
1

var n = prompt("Enter any number: ");

if (n % 2 == 0) {

   console.log("Even number.");

}

else {

   console.log("Odd number.");

}

Similar questions