Code:
<!DOCTYPE html><html>
<body>
<center>
<h1>Root of a Quadratic equation by accepting coefficients</h1>
<?php
if (isset($_POST['find']))
{
$a=$_POST['a'];
$b=$_POST['b'];
$c=$_POST['c'];
$temp=sqrt($b*$b-4*$a*$c);
$root1=(-$b+$temp)/(2*$a);
$root2=(-$b-$temp)/(2*$a);
echo "<h4>Roots of the Quadratic Equation are: ".$root1." and ".$root2."</h4>";
}
?>
<form method="post" action="index.php">
Enter value of a: <input type="number" name="a">
Enter value of b: <input type="number" name="b">
Enter value of c: <input type="number" name="c">
<input type="submit" value="Calculate" name="find">
</form>
</center>
</body>
</html>
No comments:
Post a Comment