Gran Final Campeonato Nacional Escolar Liga Las Torres 2017.pdf
Tablas u3 e5
1. INFORME
ESTUDIANTE: Chacaguasay Denisse SEMESTRE: Tercer
PARALELO: C PRÁCTICA: #16
TEMA:
Bucles de repetición
OBJETIVO:
Conocer los bucles de repetición del lenguaje de programación PHP mediante
ejercicio de aplicación.
RESULTADOS DE APRENDIZAJE
- Bucles de repetición FOR y WHILE
- Estructura y sintaxis de las mismas
ACTIVIDADES:
Realizar en PHP las tablas de multiplicar y pasar los ejercicios con for y while.
DESARROLLO DE CONTENIDOS
EJERICIO UTILIZANDO FOR
1. Código del formulario
<link rel="stylesheet" href="estilo2.css">
<FORM action="Ejercicio10.php" method="post">
<center><div style=" border: ridge #b21ec0 8px;"><font face="Cambri
a">
<label><font face="Cambria"><h3>Se desplegará las tablas de multipl
icar del número ingresado</h3></label>
<label><font face="Cambria"><h3>Se usará la sentencia FOR</h3></lab
el><br/>
</div>
</center>
<center><div style=" border: ridge #b21ec0 8px;"><font face="Cambri
a">
<label><font face="Cambria"><b>Ingrese el número</b></label><br/><b
r>
<input type="text" name="num1"/><br/><br>
<input type="submit" name="submit1" value="Calcular"/>
</div>
</center>
</form>
2. Código de las operaciones
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-
1" />
<link rel="stylesheet" href="estilo2.css">
<title>TABLAS DE MULTIPLICAR</title>
</head>
<body >
2. <hr />
<center><div style=" border: ridge #b21ec0 8px;"><font face="Cambria">
<?php
$n1 = $_POST["num1"];
if ($n1==0) {
echo "<h3>El número 0 no se permite.<h3/>";
}
else{
echo "<h3>Las tablas de multiplicar del número: ".$n1."<br><h3/>";
for ($tabla=1;$tabla<=10;$tabla++) {
$re=$tabla*$n1;
echo $tabla." x ".$n1." = ".$re."<br>";
}
}
?>
</div>
</center>
</hr>
</head>
</html>
3. Código del estilo del programa
body {
background-image:url(3.jpg);
background-size:200vw 300vh;
background-attachment:fixed;
margin:0;
}
div {
width:600px;
margin:auto;
background: rgb(208, 197, 224);
padding:10px 10px;
box-sizing: border-box;
margin-top:10px;
border-radius:7px;
}
h3{
color:#000000;
}
h2{
color:#000000;
}
p
{
font-size:24px;
color:#000000;
}
3. EJECUCIÓN DEL PROGRAMA
EJERCICIO CON WHILE
1. Código del formulario
<link rel="stylesheet" href="estilo1.css">
<FORM action="Ejercicio11.php" method="post">
<center><div style=" border: ridge #46e7ec 8px;"><font face="Cambri
a">
<label><font face="Cambria"><h3>Se desplegará las tablas de multipl
icar del número ingresado</h3></label>
<label><font face="Cambria"><h3>Se usará la sentencia WHILE</h3></l
abel><br>
</div>
</center>
<center><div style=" border: ridge #46e7ec 8px;"><font face="Cambri
a">
4. <label><font face="Cambria"><b>Ingrese el número</b></label><br/><b
r>
<input type="text" name="num1"/><br/><br>
<input type="submit" name="submit1" value="Calcular"/>
</div>
</center>
</form>
2. Código de las operaciones
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-
1" />
<link rel="stylesheet" href="estilo1.css">
<title>TABLAS DE MULTIPLICAR</title>
</head>
<body >
<hr />
<center><div style=" border: ridge #46e7ec 8px;"><font face="Cambria">
<?php
$n1 = $_POST["num1"];
if ($n1==0) {
echo "<h3>El número 0 no se permite.<h3/>";
}
else {
echo "<h3>Las tablas de multiplicar del número: ".$n1."<br><h3/>";
$tabla=1;
while ($tabla<=10) {
$re=$tabla*$n1;
echo $tabla." x ".$n1." = ".$re."<br>";
$tabla++;
}
}
?>
</div>
</center>
</hr>
</head>
</html>
3. Código de estilo del programa
body {
background-image:url(4.jpg);
background-size:200vw 300vh;
background-attachment:fixed;
margin:0;
}
div {
width:600px;
margin:auto;
background: rgb(178, 230, 240);
6. BIBLIOGRAFÍA
Luis González(2020, 30 de diciembre). “#10 ✅ Los BUCLES en PHP | ciclos
repetitivos - for - while - do while - foreach | Introduccion a PHP”, video [
YouTube] https://www.youtube.com/watch?v=-dR93VvKg1M
f.) ______________________ f.) __________________
Denisse Chacaguasay MSc. Víctor Zapata
ESTUDIANTE DOCENTE