# 解二次方程（適用於教學網站）

<title>求二次方程的解</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<body bgcolor="#FFFFFF">
<div align="center"><font color="#FF0000"><b>求二次方程的解 </b></font><b></b> </div>
<%
if Request.Form("cal")="y" then
a=trim(Request("a"))
b=trim(Request("b"))
c=trim(Request("c"))
mynum=b*b-4*a*c
%>

<%
if a=0 then%>
這不是一個二次方程，
<%if b=0 then%>

<%if c=0 then%>

<%else%>
<font color=red>條件不成立！</font>
<%end if%>
<%else%>

<%end if%>

<%elseif mynum=0 then%>
它有兩個相等的實根。X=<%=-b/(2*a)%><br>
<%elseif mynum>0 then%>
它有兩個不相等的實根。<br>
X1=<%=FormatNumber((-b+sqr(mynum))/(2*a),,-1)%><br>
X2=<%=FormatNumber((-b-sqr(mynum))/(2*a),,-1)%><br>
<%else
realpart=FormatNumber(-b/(2*a),4,-1)
imagpart=FormatNumber(sqr(-mynum)/(2*a),4,-1)
%>
此方程有兩個複根：<br>
<%=realpart%>+<%=imagpart%>i<br>
<%=realpart%>-<%=imagpart%>i<br>
<%
end if
end if
%>

<form method="post" action="try3.asp">
輸入方程參數：
<input type="text" name="a" size="5">
X<sup>2</sup>+
<input type="text" name="b" size="5">
X+
<input type="text" name="c" size="5">
=0
<input type=hidden name=cal value=y>
<input type="submit" name="Submit" value="提交">
</form>
</body>
</html>

## E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

## Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

## Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth \$300-1200 USD