función cuadratica
<html>
<head>
<title>Resolucion de una ecuacion de segundo grado.</title>
</head>
<body>
<H2>Resolucion de una ecuacion de segundo grado. </H2>
<form method="POST" action="procesa.php">
<p>a = <input type="text" name="a" size="5"></p>
<p>b = <input type="text" name="b" size="5"></p>
<p>c = <input type="text" name="c" size="5"></p>
<p><input type="reset" value="Restablecer" name="B2"> <input type="submit" value="Calcular" name="B1"></p>
</form>
</body>
</html>
----------- procesa.php
<?php
$a = $_POST['a']; $b = $_POST['b']; $c = $_POST['c'];
$neg = -1;
$menosb = $b * $neg; $oper1 = pow($b,2); $oper2 = 4*$a*$c; $resta = $oper1-$oper2; $raiz = pow($resta,(1/2)); $dosa = 2*$a;
$result1 = ($menosb + $raiz)/$dosa; $result2 = ($menosb - $raiz)/$dosa;
echo"X<sub>1</sub> = $result1<br>";
echo"X<sub>2</sub> = $result2"; ?>
<head>
<title>Resolucion de una ecuacion de segundo grado.</title>
</head>
<body>
<H2>Resolucion de una ecuacion de segundo grado. </H2>
<form method="POST" action="procesa.php">
<p>a = <input type="text" name="a" size="5"></p>
<p>b = <input type="text" name="b" size="5"></p>
<p>c = <input type="text" name="c" size="5"></p>
<p><input type="reset" value="Restablecer" name="B2"> <input type="submit" value="Calcular" name="B1"></p>
</form>
</body>
</html>
----------- procesa.php
<?php
$a = $_POST['a']; $b = $_POST['b']; $c = $_POST['c'];
$neg = -1;
$menosb = $b * $neg; $oper1 = pow($b,2); $oper2 = 4*$a*$c; $resta = $oper1-$oper2; $raiz = pow($resta,(1/2)); $dosa = 2*$a;
$result1 = ($menosb + $raiz)/$dosa; $result2 = ($menosb - $raiz)/$dosa;
echo"X<sub>1</sub> = $result1<br>";
echo"X<sub>2</sub> = $result2"; ?>
Comentarios
Publicar un comentario