filmov
tv
JavaScript Program to Check a Number for Even or Odd using Switch Statement
Показать описание
In this tutorial you will learn to write a JavaScript Program to Check if a Number is Even or Odd using Switch Statement.
First we ask the user to enter a number and we store that in a variable.
Then we divide that number by 2 and we check for the remainder value.
if the remainder is 0 then it means that the number is even, else the number is odd and then we finally we display the result on the screen using switch statement.
Install NodeJS and Set up Visual Studio Code for JavaScrpt Programming
Taking User Input using prompt-sync on nodeJS / JavaScript
our Social Media Pages
Our Website
#JavaScriptProgramming #ExampleProgram
First we ask the user to enter a number and we store that in a variable.
Then we divide that number by 2 and we check for the remainder value.
if the remainder is 0 then it means that the number is even, else the number is odd and then we finally we display the result on the screen using switch statement.
Install NodeJS and Set up Visual Studio Code for JavaScrpt Programming
Taking User Input using prompt-sync on nodeJS / JavaScript
our Social Media Pages
Our Website
#JavaScriptProgramming #ExampleProgram