-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathday2.js
32 lines (28 loc) · 1.12 KB
/
day2.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
// Activity 1
let num1 = 10, num2 = 5;
console.log(`The numbers are ${num1} and ${num2}`)
console.log("Addition:", num1 + num2); // Task 1
console.log("Subtraction:", num1 - num2); // Task 2
console.log("Multiplication:", num1 * num2); // Task 3
console.log("Division:", num1 / num2); // Task 4
console.log("Remainder:", num1 % num2); // Task 5
// Activity 2
let variable = 20;
variable += 10;
console.log("Add assignment:", variable); // Task 6
variable -= 5;
console.log("Subtract assignment:", variable); // Task 7
// Activity 3
let a = 15, b = 10;
console.log("Greater than:", a > b); // Task 8
console.log("Less than:", a < b); // Task 8
console.log("Greater or equal:", a >= b); // Task 9
console.log("Less or equal:", a <= b); // Task 9
console.log("Equal:", a == b); // Task 10
// Activity 4
console.log("Logical AND:", a > 10 && b < 20); // Task 11
console.log("Logical OR:", a < 10 || b > 5); // Task 12
console.log("Logical NOT:", !(a < b)); // Task 13
// Activity 5
let num = -5;
console.log("Ternary Operator:", num > 0 ? "Positive" : "Negative"); // Task 14