forked from Return-Ready-PT-Mon-Wed/RR-JS-Basics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathformulas.js
More file actions
81 lines (62 loc) · 1.34 KB
/
formulas.js
File metadata and controls
81 lines (62 loc) · 1.34 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
// Basic math formulaas
function addition(num1, num2){
return num1 + num2;
}
function subtraction(num1, num2){
return num1 - num2;
}
function multiplication(num1, num2){
return num1 * num2
}
function division(num1, num2){
return num1 / num2
}
// Area formulaas
function areaSquare(side1){
return side1 * side1;
}
function areaRectangle(length, width){
return length * width
}
function areaParallelogram(base, height){
return base * height
}
function areaTriangle(base, height){
return base * height * 0.5
}
function Circle(radius){
return Math.PI * radius
}
function Sphere(radius){
return 4 * Math.PI * radius
}
// Surface Area formulas
function surfaceAreaCube(side){
return 6 * side * side
}
function surfaceAreaCylinder(radius, height){
return 2 * Math.PI * radius * height
}
// Perimeter formulas
function perimeterSquare(side){
return 4 * side
}
function perimeterRectangle(length, height){
return 2 * length + 2 * height
}
function perimeterTriangle(side1, side2, side3){
return side1 * side2 * side3
}
function perimeterCircle(diameter){
return Math.PI * diameter
}
// Volume formulas
function volumeCube(side){
return side * side * side
}
function volumeRectangular(length, width, height){
return length * width * height
}
function volumeCylinder(radius, height){
return Math.PI * radius * radius * height
}