forked from omarbellaaj/htdocs
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathresolution.html
More file actions
40 lines (25 loc) · 729 Bytes
/
resolution.html
File metadata and controls
40 lines (25 loc) · 729 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
<!DOCTYPE html>
<html>
<body>
<h2>Math</h2>
<input type="number" id="a" value=""><label >x2</label> +
<input type="number" id="b" value=""> x +
<input type="number" id="c" value=""> = 0 <br><br>
<button type="button" onclick="resolve()">Resolve </button>
<p id="eq"></p>
<script>
function resolve() {
var a = document.getElementById("a").value;
var b = document.getElementById("b").value;
var c = document.getElementById("c").value;
var delta = b*b-4*a*c;
if(delta>0)
{
var x1 = (-b - Math.sqrt(delta)) / 2 * a ;
var x2 = (-b + Math.sqrt(delta)) / 2 * a ;
document.getElementById("eq").innerHTML = "2 solutions : " + x1 + " et " + x2 ;
}
}
</script>
</body>
</html>