-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharithmaticjs_functions.html
More file actions
44 lines (39 loc) · 1.07 KB
/
arithmaticjs_functions.html
File metadata and controls
44 lines (39 loc) · 1.07 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
<!DOCTYPE html>
<html>
<head>
<title>Arithmetic Functions</title>
</head>
<body>
<h1>Arithmetic Functions</h1>
<script>
function add(a, b) {
return a + b;
}
function subtract(a, b) {
return a - b;
}
function multiply(a, b) {
return a * b;
}
function divide(a, b) {
if (b === 0) {
console.error("Error: Division by zero is not allowed.");
return null;
}
return a / b;
}
// Example usage
var sum = add(589, 10);
var difference = subtract(78, 5);
var product = multiply(50, 10);
var quotient = divide(50, 5);
document.write("Sum: " + sum);
document.write("<br>");
document.write ("Difference: " + difference);
document.write("<br>");
document.write("Product: " + product);
document.write("<br>");
document.write("Quotient: " + quotient);
</script>
</body>
</html>