-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththree.js
98 lines (90 loc) · 1.65 KB
/
three.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// Task 1
let num = -5;
if (num > 0) {
console.log("Number is positive");
} else if (num < 0) {
console.log("Number is negative");
} else {
console.log("Number is zero");
}
// Task 2
const age = 19;
if (age >= 18) {
console.log("You are eligible for voting");
} else {
console.log("You are not eligible for voting");
}
// Task 3
let a = 3;
let b = 4;
let c = 5;
if (a >= b && a >= c) {
console.log(`${a} is greater among three`);
}
if (b >= a && b >= c) {
console.log(`${b} is greater among three`);
}
if (c >= a && c >= b) {
console.log(`${c} is greater among three`);
}
//Task 4
let day = 5;
switch (day) {
case 1:
console.log("Monday");
break;
case 2:
console.log("Tuesday");
break;
case 3:
console.log("Wednesday");
break;
case 4:
console.log("Thursday");
break;
case 5:
console.log("Friday");
break;
case 6:
console.log("Saturday");
break;
case 7:
console.log("Sunday");
break;
default:
console.log("Enter valid day number");
break;
}
// Task 5
let marks = 9;
switch (true) {
case marks >= 90:
console.log("A");
break;
case marks >= 80:
console.log("B");
break;
case marks >= 70:
console.log("C");
break;
case marks >= 60:
console.log("D");
break;
case marks >= 50:
console.log("F");
break;
default:
console.log("Failed");
break;
}
//Task 6
let number = 9;
let res = number % 2 == 0 ? "Number is even" : "Number is odd";
console.log(res);
//Task 7
let year = 2001;
if ((year % 4 == 0 && year !== 100) || year % 400 == 0) {
console.log(`${year} is leap year`);
} else {
console.log(`${year} is not leap year`);
}