Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Programación
Instituto IACC
30/09/2019
Desarrollo
Ejercicio 1
<!DOCTYPE html>
<html>
<head>
<title>Números decrecientes con ciclo FOR</title>
</head>
<body>
<?php
print "<p>Inicio</p>\n";
for ($i = 30; $i >= 10; $i--) {
print "<p>$i</p>\n";
}
print "<p>Termino</p>\n";
?>
</body>
</html>
Pantallazo PHPtester.net:
*Incluí 2 pantallazos de este resultado, ya que lo realicé en forma vertical para una
presentación más clara y ordenada.
Ejercicio 2
<!DOCTYPE html>
<html>
<head>
<title>Doble del valor ciclo WHILE</title>
</head>
<body>
<?php
$n = 1;
Ejercicio 3
<!DOCTYPE html>
<html>
<head>
<title>Variable Meses del año</title>
</head>
<body>
<?php
$i = rand(1, 12);
switch ($i) {
case '1':
echo "Enero";
break;
case '2':
echo "Febrero";
break;
case '3':
echo "Marzo";
break;
case '4':
echo "Abril";
break;
case '5':
echo "Mayo";
break;
case '6':
echo "Junio";
break;
case '7':
echo "Julio";
break;
case '8':
echo "Agosto";
break;
case '9':
echo "Septiembre";
break;
case '10':
echo "Octubre";
break;
case '11':
echo "Noviembre";
break;
case '12':
echo "Diciembre";
break;
}
?>
</body>
</html>
Pantallazo PHPtester.net:
Ejercicio 4
<!DOCTYPE html>
<html>
<head>
<title>Variable para calcular sueldo</title>
</head>
<body>
<?php
Pantallazo PHPtester.net:
Ejercicio 5
<!DOCTYPE html>
<html>
<head>
<title>Selección equipo de basquetball</title>
</head>
<body>
<?php
$array = array(
0 => array("Rodrigo","1.90","37"),
1 => array("Andrés","1.78","17"),
2 => array("Tomás","1.75","18")
);
for($i=0; $i < count($array); $i++){
print "<br>";
echo $array[$i][0].": eres bienvenido al equipo de basquetball<br />";
}
else{
print "<br>";
echo $array[$i]["0"].": no es apto para entrar al equipo de basquetball"."<br/>";
}
}
?>
</body>
</html>
Pantallazo PHPtester.net:
Bibliografía