7.21練習5
阿新 • • 發佈:2017-07-22
rom d+ rip html bsp else meta parseint utf-8
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
</body>
</html>
<script>
a=prompt("請輸入a","")
b=prompt("請輸入b","")
c=prompt("請輸入c","")
a = parseInt(a);
b = parseInt(b);
c = parseInt(c);
d=-b
e=2*a
x=b*b-4*a*c
y=d/e
z=Math.sqrt(x)
f=d+z
g=d-z
h=f/e
i=g/e
if(x<0){
alert("無實根")
}
else{
if(x==0){
alert(y)
}
else{
if(x>0){
alert(h+","+i)
}
}
}
</script>
7.21練習5