-
Notifications
You must be signed in to change notification settings - Fork 0
/
08.praticesets_02.js
54 lines (50 loc) · 1.07 KB
/
08.praticesets_02.js
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Chapter 2 Practice set
const prompt=require("prompt-sync")({sigint:true});
/*
// Problem no. 1
let age = prompt("Hi , Please tell me your age ")
if(age>=10 && age<=20){
console.log("You are in between 10 to 20")
}
// Problem No.2
let a = prompt("Hi tell a ")
a = Number.parseInt(a)
switch (a) {
case 10:
console.log("Hi 10")
break;
case 14:
console.log("Hi 20")
break;
default:
console.log("Your age is not special")
break;
}*/
/*
// Problem no.3
let b = Number.parseInt(prompt("Hi please tell a number"))
console.log(typeof b)
c=b%2
d=b%3
if(c==0){
console.log("The number is divisible by 2")
}
else if(d==0){
console.log("The number is divisible by 3")
}
else{
console.log(`hi`)
};
// Problem no 4
let b = Number.parseInt(prompt("Hi please tell a number"))
console.log(typeof b)
c=b%2
d=b%3
if(c==0 && d==0){
console.log("The number is divisible by 2 and 3")
}
*/
// Problem no 5
let age = parseInt(prompt("Enter Your Age"))
console.log(typeof age);
console.log(`You can`,age>18? "Drive": "Cannot Drive");