Lưu trữ

Posts Tagged ‘Giải phương trình bậc nhất – [PHP(tt)]’

Giải phương trình bậc nhất – [PHP(tt)]

Tháng Năm 9, 2009 2 bình luận

Tiếp tục bài tập về kỹ thuật lập trình PHP

Viết chương trình giải phương trình bậc nhất

Kết quả do Viet Matrix Revolutions thực hiện

Gải phương trình bậc nhất - Viet Matrix Revolutions

Gải phương trình bậc nhất - Viet Matrix Revolutions

Và đây là code

==========
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;
<html xmlns=”http://www.w3.org/1999/xhtml”&gt;
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>giải phương trình bậc nhất</title>
<style type=”text/css”>
<!–
.style1 {color: #FFFFFF}
.style3 {color: #FF0000; font-weight: bold; }
–>
</style>
</head>

<body>
<?php
/*
Viet Matrix Revolutions
Anderson_neo – AlexBTP . . . and member Viet Matrix Revolutions
*/
if(isset($_POST[“x1”]) && isset($_POST[“x2”]))
{
$x1=$_POST[“x1”];
$x2=$_POST[“x2”];
$nghiem=$_POST[“nghiem”];
if($x1==0)
{
$nghiem=”Phương Trình Vô Nghiệm “;
}
elseif($x1<>0)
{
$x3=-($x1/$x2);
$x3=round($x3,2);
$nghiem=$x3;
}

}
?>
<form id=”form1″ name=”form1″ method=”post” action=”giaiphuongtrinhbacnhat.php”>
<table width=”400″ border=”0″ align=”center” bgcolor=”#000000″>
<tr>
<td colspan=”5″ align=”center”><h1 class=”style1″>Giải phương trình bậc nhất </h1></td>
</tr>
<tr>
<td width=”135″ bgcolor=”#000000″><span class=”style1″><strong>Phương Trình </strong></span></td>
<td width=”66″><label>
<input name=”x1″ type=”text” id=”x1″ value=”<?php echo $_POST[“x1″];?>” size=”10″ />
</label></td>
<td width=”29″><span class=”style1″><strong>X</strong></span></td>
<td width=”65″><label>
<input name=”x2″ type=”text” id=”x2″ value=”<?php echo $_POST[“x2″];?>” size=”10″ />
</label></td>
<td width=”83″> <span class=”style1″><strong>= 0 </strong></span></td>
</tr>
<tr>
<td bgcolor=”#000000″><span class=”style1″><strong>Nghiệm</strong></span></td>
<td colspan=”4″><label>
<input name=”nghiem” type=”text” id=”nghiem” value=”<?php echo $nghiem;?>” readonly=”true”
style=”background-color:#FFCCFF”/>
</label></td>
</tr>
<tr>
<td colspan=”5″ align=”center”><label>
<input type=”submit” name=”Submit” value=”Giải Phương Trình” />
<span class=”style3″>Viet Matrix Revolutions </span></label></td>
</tr>
</table>
</form>
</body>
</html>

==========

Toàn quyền thuộc về Viet Matrix Revolutions.Ghi rõ nguồn khi phát hành lại thông tin này

Anderson_neo , AlexBTP and member Viet Matrix Revolutions