-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathformulas.js
More file actions
100 lines (81 loc) · 2.03 KB
/
formulas.js
File metadata and controls
100 lines (81 loc) · 2.03 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// Basic math formulaas
function addition(num1, num2) {
return num1 + num2
}
console.log(addition(5, 7));
function subtraction(num1, num2) {
return num1 - num2
}
console.log(subtraction(7, 5));
function multiplication(num1, num2) {
return num1 * num2
}
console.log(multiplication(5, 7));
function division(num1, num2) {
return num1 / num2
}
console.log(division(6, 3));
// Area formulaas
function areaSquare(side) {
return side * side
}
console.log(areaSquare(7));
function areaRectangle(length, width) {
return length * width
}
console.log(areaRectangle(5, 7));
function areaParallelogram(base, height) {
return base * height
}
console.log(areaParallelogram(5, 7));
function areaTriangle(base, height) {
return .5 * base * height
}
console.log(areaTriangle(5, 7));
function Circle(radius) {
return Math.PI * radius * radius
}
console.log(Circle(7));
function Sphere(radius) {
return 4 * Math.PI * radius * radius
}
console.log(Sphere(7));
// Surface Area formulas
function surfaceAreaCube(side) {
return 6 * side * side
}
console.log(surfaceAreaCube(7));
function surfaceAreaCylinder(radius, height) {
return 2 * Math.PI * radius * height
}
console.log(surfaceAreaCylinder(5, 7));
// Perimeter formulas
function perimeterSquare(side) {
return 4 * side
}
console.log(perimeterSquare(7));
function perimeterRectangle(length, height) {
return (2 * length) + (2 * height)
}
console.log(perimeterRectangle(5, 7));
function perimeterTriangle(side1, side2, side3) {
return side1 + side2 + side3
}
console.log(perimeterTriangle(6, 7, 8));
function perimeterCircle(diameter) {
return Math.PI * diameter
}
console.log(perimeterCircle(7));
// Volume formulas
function volumeCube(side) {
return side * side * side
}
console.log(volumeCube(7));
function volumeRectangular(length, width, height) {
return length * width * height
}
console.log(volumeRectangular(6, 7, 8));
function volumeCylinder(radius, height) {
return Math.PI * radius * radius * height
}
console.log(volumeCylinder(5, 7));