javascript

JavaScript to find Odd or Even number!

This is another interesting program for school / college students who are learning JavaScript.

To find an entered number is Odd or Even is very simple, all you have to do is divide the number by 2 and if you get the remainder 0 (zero) then it is an Even number otherwise an Odd number.

Eg: 10 / 2 = 5, here 5 is the quotient, 0 is the remainder.

In JavaScript there are two operators you can use to find quotient and remainder. (/) slash and (%) modulus, where the / will give the quotient and % will give the remainder value. 

So here is the JavaScript snippet:

For better understanding I am giving here a full example :

And as always your demo:

demo

 

Related Posts

3 thoughts on “JavaScript to find Odd or Even number!

Leave a Reply