-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathps2.js
More file actions
36 lines (30 loc) · 739 Bytes
/
ps2.js
File metadata and controls
36 lines (30 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
let prompt = require("prompt-sync")()
// demonstrating the use of switch case in js
/*
let name = prompt("Enter your name: ");
switch (name){
case "anant":
console.log("Welcome admin");
break;
case "shiv":
console.log("Welcome co-admin");
break;
case "param":
console.log("Welcome CEO");
break;
default:
console.log("You're not a member of our team");
break;
}
*/
// number is divisible by 2 or 3 or not?
let num = prompt("Enter the number: ");
num = Number.parseInt(num);
let case1 = num%2 == 0;
let case2 = num%3 == 0;
if (case1 && case2){
console.log("It is divisible by 2 & 3 both");
}
else {
console.log("No it is not divible by 2 & 3");
}