Activity 1: Arithmetic Operations
- Task 1: Write a program to add two numbers and log the result to the console.
- Task 2: Write a Program to subtract two numbers and log the result to the console.
- Task 3: Write a program to multiply two numbers and log the result to the console.
- Task 4: Write a program to divide two numbers and log the result to the console.
- Task 5: Write a program to find the remainder when one number is divided by another and log the result to the console.
Activity 2: Assignment Operators
- Task 6: Use the
+=operator to add a number to a variable and log the result to the console. - Task 7: Use the
-=operator to subtract a number from a variable and log the result to the console.
Activity 3: Comparison Operators
- Task 8: Write a program to compare two numbers using
>and<log the result to the console. - Task 9: Write a program to compare two numbers using
>=and<=log the result to the console. - Task 10: Write a program to compare two numbers using
==and===log the result to the console.
Activity 4: Logical Operators
- Task 11: Write a program that uses the
&&operator to combine two conditions and log the result to the console. - Task 12: Write a program that uses the
||operator to combine two conditions and log the result to the console. - Task 13: Write a program that uses the
!operator to negate condition and log the result to the console.
Activity 5: Ternary Operator
- Task 14: Write a program that uses the ternary operator to check if a number is positive or negative and log the result to the console.
-
Arithmetic Operations Script: Write a script that performs basic arithmetic operations (addition, subtraction, multiplication, division, remainder) on two numbers and logs the results.
-
Comparison and Logical Operators: Create a script that compares two numbers using different comparison operators and combines conditions using logical operators, logging the results.
-
Ternary Operator Script: Write a script that uses the ternary operator to determine if a number is positive or negative and logs the result.
By the end of these activities, you will:
- Understand and use arithmetic operators to perform basic calculations.
- Use assignment operators to modify variable values.
- Compare values using comparison operators.
- Combine conditions using logical operators.
- Use the ternary operator for concise conditional expressions.
