-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction.js
More file actions
42 lines (31 loc) · 905 Bytes
/
Copy pathfunction.js
File metadata and controls
42 lines (31 loc) · 905 Bytes
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
40
41
42
function calculateSum(num1, num2) {
return num1 + num2;
}
console.log(calculateSum(2, 5));
console.log(calculateSum(10, 10));
console.log(calculateSum(5, 5));
function calculateDifference(num1, num2) {
return num1 - num2;
}
console.log(calculateDifference(22, 5));
console.log(calculateDifference(12, 1));
console.log(calculateDifference(17, 9));
function calculateProduct(num1, num2) {
return num1 * num2;
}
console.log(calculateProduct(13, 5));
function calculateQuotient(num1, num2) {
return num2 === 0 ? "Error: Division by zero" : num1 / num2;
}
console.log(calculateQuotient(7, 11));
console.log(calculateQuotient(3, 0));
function calculateSquare(num) {
return num ** 2;
}
console.log(calculateSquare(2));
console.log(calculateSquare(9));
function calculateSquareRoot(num) {
return Math.sqrt(num);
}
console.log(calculateSquareRoot(25));
console.log(calculateSquareRoot(100));