Table of Contents
show
Example 13:
Write a JavaScript to check whether a number is even or not
const prompt = require("prompt-sync")();
let n = prompt("Enter a number");
n = parseInt(n);
if (n % 2 == 0) {
console.log(`${n} is even`);
} else {
console.log(`${n} is odd`);
}
Output
Views: 82