Skip to content

Latest commit

 

History

History
50 lines (33 loc) · 2.58 KB

Day 2 - Operators Assignment.md

File metadata and controls

50 lines (33 loc) · 2.58 KB

Day 2: Operators

Tasks/Activities:

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 < and log the result to the console.
  • Task 9: Write a program to compare two numbers using >= and <= and log the result to the console.
  • Task 10: Write a program to compare two numbers using == and === 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 a 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.

Feature Request:

  1. Arithmetic Operations Script: Write a script that performs basic arithmetic operations (addition, subtraction, multiplication, division, remainder) on two numbers and logs the results.
  2. Comparison and Logical Operators Script: Create a script that compares two numbers using different comparison operators and combines conditions using logical operators, logging the results.
  3. Ternary Operator Script: Write a script that uses the ternary operator to determine if a number is positive or negative and logs the result.

Achievement:

By the end of these activities, students 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.