About Lesson
Arithmatic Operators
Used for performing basic arithmetic operations:
- + (Addition): 5 + 2 = 7
- – (Subtraction): 5 – 2 = 3
- * (Multiplication): 5 * 2 = 10
- / (Division): 10 / 2 = 5
- % (Modulus): 10 % 3 = 1 (remainder)
Example:
JavaScript
// Declare two variables
let num1 = 10;
let num2 = 5;
// Perform arithmetic operations
let sum = num1 + num2; // Addition
let difference = num1 - num2; // Subtraction
let product = num1 * num2; // Multiplication
let quotient = num1 / num2; // Division
let remainder = num1 % num2; // Modulus
// Display results
console.log("Sum: " + sum); // 15
console.log("Difference: " + difference); // 5
console.log("Product: " + product); // 50
console.log("Quotient: " + quotient); // 2
console.log("Remainder: " + remainder); // 0