-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcal2num.html
More file actions
32 lines (32 loc) · 933 Bytes
/
cal2num.html
File metadata and controls
32 lines (32 loc) · 933 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
<!DOCTYPE html>
<html>
<head>
<title>Math Functions</title>
</head>
<body>
<h2>Math Functions Example</h2>
Enter First Number:
<input type="number" id="num1"><br><br>
Enter Second Number:
<input type="number" id="num2"><br><br>
<button onclick="calculate()">Calculate</button>
<p id="result"></p>
<script>
function calculate() {
var a = parseFloat(document.getElementById("num1").value);
var b = parseFloat(document.getElementById("num2").value);
var sqrt = Math.sqrt(a);
var power = Math.pow(a, b);
var maximum = Math.max(a, b);
var minimum = Math.min(a, b);
var difference = Math.abs(a - b);
document.getElementById("result").innerHTML =
"Square Root of first number: " + sqrt + "<br>" +
"Power (a^b): " + power + "<br>" +
"Maximum: " + maximum + "<br>" +
"Minimum: " + minimum + "<br>" +
"Absolute Difference: " + difference;
}
</script>
</body>
</html>