-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP2.js
More file actions
58 lines (57 loc) · 1.44 KB
/
P2.js
File metadata and controls
58 lines (57 loc) · 1.44 KB
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
55
56
57
58
//Q-1
// let age = prompt("What is your agr?")
let age = 11;
if(age>10 && age<20){
console.log("your age is 10 and 20");
}
else{
console.log("Your age does't lies between 10 and 20..");
}
//Q-2
// let fruit = prompt("Enter your favourite fruit name:");
let fruit = "Strawberry";
switch (fruit) {
case "Apple":
console.log("Apple is red or green in color.");
break;
case "Banana":
console.log("Banana is yellow and rich in potassium.");
break;
case "Mango":
console.log("Mango is the king of fruits and is sweet.");
break;
case "Orange":
console.log("Orange is citrus and rich in vitamin C.");
break;
case "Strawberry":
console.log("Strawberries are juicy, sweet, and deep red fruits that are often grown near hills and plains.");
break;
default:
console.log("Unknown fruit.");
}
//Q-3
// let num = prompt("Enter the any number:");
let num = 17;
if(num%2 == 0 && num%3 == 0){
console.log("Number is Divisible by 2 and 3");
}
else{
console.log("Number doesn't Divisible by 2 and 3");
}
//Q-4
let num1 = 18;
if(num1%2 == 0 && num1%3 == 0){
console.log("Number is Divisible by 2 or 3");
}
else{
console.log("Number doesn't Divisible by 2 or 3");
}
//Q-5
// let Yourage = prompt("Enter Your age for your eligibility:");
let Yourage = 18;
if(Yourage>18){
console.log("You can Drive..");
}
else{
console.log("You cannot Drive..");
}