1. Universidad Latina de Panamá_Ingeniería en Sistemas Informáticos_Curso de Programación 4
Prof. Rafael Vejarano Alumno: Enrique Puentes R.
Asignación: Problemas sobre programación PHP y HTML.
Problema 1: Realiza un programa que pida dos numeros y luego muestre el resultado de su
multiplicación.
<!--
COMENTARIOS EN HTML:
Aplicacion que multiplica dos numeros. El programa ejercicio1a.php recoge los datos y el programa
producto.php multiplica los dos numeros que recibe y muestra el resultado.
-->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<h3>Calcula la multiplicacion de dos numeros
</h3>
<form action="producto.php" method="get">
Primer numero:<input type="number" name="a"><br>
Segundo numero:<input type="number" name="b"><br>
<input type="submit" value="multiplicacion"><br>
</form>
</body>
</html>
<!--
COMENTARIOS EN HTML:
producto.php devuelve el producto de los dos numeros que entrega ejercicio.php
-->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<?php
$a=$_GET['a'];
$b=$_GET['b'];
echo "La multiplicacion de $a por $b es ", $a * $b;
?>
</body>
2. Universidad Latina de Panamá_Ingeniería en Sistemas Informáticos_Curso de Programación 4
Prof. Rafael Vejarano Alumno: Enrique Puentes R.
Asignación: Problemas sobre programación PHP y HTML.
</html>
Problema 2: Escribe un programa que sume, reste, multiplique y divida dos numeros introducidos
por teclado.
<!--
COMENTARIOS EN HTML:
El programa problema2.php recoge los datos y otros subprogramas realizan las operaciones
aritmeticas. Los resultados se devuelven a problema2.php y luego se muestran en el sitio web del
servidor.
-->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<h3>Realiza diversas operaciones aritmeticas con dos numeros solicitados
</h3>
<form action="suma.php" method="get">
Primer numero:<input type="number" name="a"><br>
Segundo numero:<input type="number" name="b"><br>
<input type="submit" value="suma"><br>
</form>
<form action="resta.php" method="get">
Primer numero:<input type="number" name="a"><br>
Segundo numero:<input type="number" name="b"><br>
<input type="submit" value="resta"><br>
</form>
<form action="producto.php" method="get">
Primer numero:<input type="number" name="a"><br>
Segundo numero:<input type="number" name="b"><br>
<input type="submit" value="multiplicacion"><br>
</form>
<form action="division.php" method="get">
Primer numero:<input type="number" name="a"><br>
Segundo numero:<input type="number" name="b"><br>
<input type="submit" value="division"><br>
</form>
</body>
</html>
3. Universidad Latina de Panamá_Ingeniería en Sistemas Informáticos_Curso de Programación 4
Prof. Rafael Vejarano Alumno: Enrique Puentes R.
Asignación: Problemas sobre programación PHP y HTML.
<!--
COMENTARIOS EN HTML
suma.php devuelve la suma de los dos numeros que entrega problema2.php
-->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<?php
$a=$_GET['a'];
$b=$_GET['b'];
echo "La suma de $a y $b es ", $a + $b;
?>
</body>
</html>
<!--
COMENTARIOS EN HTML:
resta.php devuelve la resta de los dos numeros que entrega problema2.php
-->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<?php
$a=$_GET['a'];
$b=$_GET['b'];
echo "La resta de $a menos $b es ", $a - $b;
?>
</body>
</html>
4. Universidad Latina de Panamá_Ingeniería en Sistemas Informáticos_Curso de Programación 4
Prof. Rafael Vejarano Alumno: Enrique Puentes R.
Asignación: Problemas sobre programación PHP y HTML.
<!--
COMENTARIOS EN HTML:
producto.php devuelve el producto de los dos numeros que entrega ejercicio.php
-->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<?php
$a=$_GET['a'];
$b=$_GET['b'];
echo "La multiplicacion de $a por $b es ", $a * $b;
?>
</body>
</html>
<!--
COMENTARIOS EN HTML:
division.php devuelve la division de los dos numeros que entrega problema2.php
-->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<?php
$a=$_GET['a'];
$b=$_GET['b'];
echo "La division de $a entre $b es ", $a / $b;
?>
</body>
</html>
5. Universidad Latina de Panamá_Ingeniería en Sistemas Informáticos_Curso de Programación 4
Prof. Rafael Vejarano Alumno: Enrique Puentes R.
Asignación: Problemas sobre programación PHP y HTML.
Problema 3: Realiza un programa conversor de kilogramos a libras.
<!--
COMENTARIOS EN HTML:
El programa ConversorKilosALibras transforma de Kg a Libras y viceversa. Utiliza dos subprogramas
que reciben el valor de a y lo transforman en b.
-->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<h3>Conversor de Kilogramos a Libras
</h3>
<form action="KilosALibras.php" method="get">
Numero:<input type="number" name="a"><br>
<input type="submit" value="Kg a Libras"><br><br>
</form>
<form action="LibrasAKilos.php" method="get">
Numero:<input type="number" name="a"><br>
<input type="submit" value="Libras a Kg"><br>
</form>
</body>
</html>
<!--
COMENTARIOS EN HTML:
KilosALibras.php devuelve la conversion de Kg a Libras.
-->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<?php
$a=$_GET['a'];
$b=$a * 2.2;
echo "$a Kilogramos equivalen a $b libras";
?>
6. Universidad Latina de Panamá_Ingeniería en Sistemas Informáticos_Curso de Programación 4
Prof. Rafael Vejarano Alumno: Enrique Puentes R.
Asignación: Problemas sobre programación PHP y HTML.
</body>
</html>
<!--
COMENTARIOS EN HTML:
LibrasAKilos.php devuelve la conversion de Libras a Kilogramos.
-->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<?php
$a=$_GET['a'];
$b=$a * 0.4536;
echo "$a Libras equivalen a $b Kilogramos";
?>
</body>
</html>
Problema 4: Modifique el ejercicio 6 para que reciba los dos valores desde el teclado.
<!--
COMENTARIOS EN HTML:
Programa que compara dos numeros y nos dice cual es menor.
-->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<h3>Compara dos numeros e identifica al menor.
</h3>
<form action="MenorQue.php" method="get">
Primer Numero:<input type="number" name="a"><br><br>
Segundo Numero:<input type="number" name="b"><br><br>
<input type="submit" value="Comparar"><br><br>
</form>
7. Universidad Latina de Panamá_Ingeniería en Sistemas Informáticos_Curso de Programación 4
Prof. Rafael Vejarano Alumno: Enrique Puentes R.
Asignación: Problemas sobre programación PHP y HTML.
</body>
</html>
<!--
COMENTARIOS EN HTML
Compara el contenido de dos variables numericas y devuelve el mensaje de si el primer numero es o
no menor que el segundo al formulario ComparaNumeros.php
-->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<?php
$a=$_GET['a'];
$b=$_GET['b'];
if ($a<$b) {
echo "$a es menor que $b";
}
else{
echo "$a no es menor que $b";
}
?>
</body>
</html>
Problema 5: Escribe un programa que dando un numero del 1 al 7, escriba el correspondiente día de
la semana.
<!--
COMENTARIOS EN HTML:
Programa que solicita un numero y a traves de un subprograma devuelve el correspondiente dia de la
semana.
-->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
8. Universidad Latina de Panamá_Ingeniería en Sistemas Informáticos_Curso de Programación 4
Prof. Rafael Vejarano Alumno: Enrique Puentes R.
Asignación: Problemas sobre programación PHP y HTML.
<h3>Introduce un numero del 1 al 7 y te digo que dia de la semana es.
</h3>
<form action="Dia.php" method="get">
Numero:<input type="number" name="a"><br><br>
<input type="submit" value="El dia correspondiente es: "><br><br>
</form>
</body>
</html>
<!--
COMENTARIOS EN HTML:
Subprograma que recibe un numero y devuelve el correspondiente dia de la semana.
-->
<?php
$a=$_GET['a'];
switch ($a) {
case '1':
echo "Lunes";
break;
case '2':
echo "Martes";
break;
case '3':
echo "Miercoles";
break;
case '4':
echo "Jueves";
break;
case '5':
echo "Viernes";
break;
case '6':
echo "Sabado";
break;
case '7':
echo "Domingo";
break;
default:
echo "Elija entre el 1 y el 7";
break;
}
?>