forked from lsvekis/JavaScript-Exercises-Book
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasic Arithmetic Operations
More file actions
18 lines (18 loc) · 880 Bytes
/
Basic Arithmetic Operations
File metadata and controls
18 lines (18 loc) · 880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Objective: Perform arithmetic operations and store their results in variables.
// 1. Declare two variables, a and b, and assign them values of 5 and 3, respectively.
let a = 5;
let b = 3;
// 2. Declare a variable named sum and assign it the result of adding a and b.
let sum = a + b;
// 3. Declare a variable named difference and assign it the result of subtracting b from a.
let difference = a - b;
// 4. Declare a variable named product and assign it the result of multiplying a and b.
let product = a * b;
// 5. Declare a variable named quotient and assign it the result of dividing a by b.
let quotient = a / b;
// 6. Print the results to the console.
console.log("Sum: " + sum);
console.log("Difference: " + difference);
console.log("Product: " + product);
console.log("Quotient: " + quotient);
// Exercise: Modify values of a and b and observe the changes in the output.