forked from coach-stephanie/te2018grade9term1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmath.js
More file actions
39 lines (37 loc) · 1.21 KB
/
math.js
File metadata and controls
39 lines (37 loc) · 1.21 KB
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
33
34
35
36
37
38
39
// Variables
let num1 = 5;
let num2 = 10;
// **** Problem 1 ****
// Store the sum of num1 and num2 in a variable.
// Print the sum.
let sum = num1 + num2;
console.log(sum);
// **** Problem 2 ****
// Store the difference between sum (above) and 7 in a variable.
// Print the difference.
//let num3 = num1 + num2
let difference = sum - 7;
console.log(difference);
// **** Problem 3 ****
// Store the product of difference and 3 in a variable.
// Print the product.
let product = difference * 3;
console.log(product);
// **** Problem 4 ****
// Store the power of the product raised to an exponent of 2 in a variable.
// Print the power.
let power = product **2;
console.log(exponent);
// **** Problem 5 ****
// Store the quotient of the power divided by 4 in a variable.
// Print the quotient.
let quotient = power / 4
console.log(quotient);
// **** Problem 6 ****
// Store the remainder of the quotient divided by 2 in a variable.
// Print the remainder.
let remainder = quotient % 2;
console.log(remainder);
// Hint: You can tell if a value is even or odd if it is divisible by 2;
// in other words, if there is no remainder after dividing the value by
// 2, then the value is even. See problem 6!