Documentos de Académico
Documentos de Profesional
Documentos de Cultura
1. Desarrolle un programa PHP que imprima un encabezado, el detalle de la suma, la cantidad de los
números múltiplos de 3 y el promedio de los múltiplos de 3, comprendidos entre N y M donde N es el
número menor y M es el número mayor. Debe capturar N y M a través de un formulario. La salida
debe ser parecida a:
Universidad de Panamá
FIEC
SUMA DE LOS MÚLTIPLOS DE 3 DE N HASTA M.
6+9+…+N=SUMA
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> ciclos de php parcial </title>
</head>
<body>
<table border="1" width="1350px" height="50px">
<tr>
<td bgcolor="#0099FF"><h2><center> UNIVERSIDAD DE PANAMA </center></h2>
<h2><center> FACULTAD DE INFORMATICA, ELECTRONICA Y COMUNICACION
</center></h2>
<h2><center> parcial 2 </center></h2></td>
</tr>
</table>
<br>
<form name="" method="post" action="phpprogpar.php">
</body>
</html>
PHP
<?php
$numero2 = $_POST["num2"];
$num1 = $_POST["num1"];
$sumatoria= 0;
$multiplos = 0;
<body>
<table border="1" width="1350px" height="50px">
<tr>
<td bgcolor="#0099FF"><h2><center> UNIVERSIDAD DE PANAMA </center></h2>
<h2><center> FACULTAD DE INFORMATICA, ELECTRONICA Y COMUNICACION </center></h2>
<h2><center>SOLUCIÓN DE LA ECUACIÓN 2X+X2+4 =Y </center></h2><br />
<h2><center>PARA VALORES DE N HASTA M </center></h2><br />
<h2><center> 2 </center></h2></td>
</tr>
</table>
<form method="POST" action="procesa1.php">
<p>a = <input type="text" name="m" size="5"></p>
<p>b = <input type="text" name="n" size="5"></p>
<p><input type="reset" value="Restablecer" name="B2"> <input type="submit"
value="Calcular" name="B1"></p>
</form>
</body>
</html>
PHP
<?php
$M=$_POST['m'] ;
$N=$_POST['n'];
$sol1=(float)0;
$sol2=(float)0;
$r=(float)0;
$r=$N*$N+4*$M*$N;
if ($r>=0)
{
$sol1 = (-$N + sqrt($r)) / (2*$M);
$sol2 = (-$N - sqrt($r)) / (2*$M);
print "ecuacion: $M x*x +$N*x <BR>";
print "tiene de soluciones $sol1 y $sol2\n";
}
else
{
print "ecuacion: $M x*x +$N*x <BR>";
print "No tiene solucion <BR>";
}
?>