-
Notifications
You must be signed in to change notification settings - Fork 0
/
07_practice_set_2.js
39 lines (36 loc) · 1.03 KB
/
07_practice_set_2.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
//chapter 2 practice set
//q1
const prompt = require('prompt-sync')();
// let age = prompt("What is your age?");
// age = Number.parseInt(age);
// if (age > 10 && age <= 20) {
// console.log("your age lies between 10 and 20")
// } else {
// console.log("your age does not lies between 10 and 20")
// }
//q2
// let age = prompt("What is your age?")
// switch (age) {
// case '12':
// console.log("your age is 12")
// break
// case '13':
// console.log("your age is 13")
// break
// case '14':
// console.log("your age is 14")
// break
// default:
// console.log("your age is not special")
// }
//q3
// let product = prompt("Enter the number")
// product = parseInt(product) //converting the number to integer
// if (product % 2 == 0 && product % 3 == 0) {
// console.log("The number is divisible by 2 and 3")
// } else {
// console.log("The number is not divisible by 2 and 3")
// }
//q4
let age = prompt("What is your age?")
let a = age > 18 ? console.log("you can drive") : console.log("you cannot drive")