ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

5AM PROGRAMACION


Enviado por   •  9 de Noviembre de 2020  •  Biografías  •  2.123 Palabras (9 Páginas)  •  95 Visitas

Página 1 de 9

AGUILAR GUZMAN AXEL EDUARDO

EXAMEN PARCIAL

PROFESOR: GERARDO LOO TOY SERGIO

5AM PROGRAMACION


  PROBLEMA 1

<!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=utf-8" />

<title>Documento sin título</title>

</head>

<body>

<!—AGUILAR GUZMAN AXEL EDUARDO -->

<form action="" method="POST">

<label>Oración a invertir</label>

<input type="text" name="cadena" placeholder="Oración a Invertir" /><br />

<input type="submit" value="Enviar" />

</form>

<?php

if ($_POST) {

    $cadena = $_POST['cadena'];

    $resultado = "";

    $longitud = strlen($cadena);

    $ultimoEspacio = 0;

    $caracteresAlEspacio = 0;

    for ($i = 0; $i <= $longitud; $i++) {

        $caracter = substr($cadena, $i, 1);

        if ($caracter == ' ') {

            $caracteresAlEspacio = $i - $ultimoEspacio;

            $resultado = substr($cadena, $ultimoEspacio, $caracteresAlEspacio) . " " . $resultado;

            $ultimoEspacio = $i+1;

        } else if ($i == $longitud) {

            $resultado = substr($cadena, $ultimoEspacio) . " " . $resultado;

        }

    }

    echo $resultado;

}

?>

</body>

</html>  


PROBLEMA 2

<!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=utf-8" />

<title>Documento sin título</title>

</head>

<body>

<!—aguilar guzman axel eduardo-->

<?php

$lineas= 20;

for($i = 0; $i <= 7; $i++) {

    for ($lin=0; $lin < $lineas-$i; $lin++) {

        echo "_";

    }

    for ($fig=0-$i; $fig <= $i; $fig++){

        echo "0";

    }

    echo "<br>";

}

for($i = 6; $i >= 0; $i--) {

   

    for ($lin=0; $lin < $lineas-$i; $lin++) {

        echo "_";

    }

    for ($fig=0-$i; $fig <= $i; $fig++){

        echo "0";

    }

    echo "<br>";

}

?>

</body>

</html>


PROBLMEA 3

<!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=utf-8" />

<title>Documento sin título</title>

</head>

<body>

<!—aguilar guzman axel eduardo-->

<?php

$i = 0;

$z = 1;

do {        

    echo $i . "<br>";

    $t = $i + $z;

    $i = $z;

    $z = $t;

} while ($i <= 1597);

?>

</body>

</html>


PROBLEMA 4

<!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=utf-8" />

<title>Documento sin título</title>

</head>

<body>

<!—aguilar guzman axel eduardo-->

<form action="" method="POST">

<label>Ingrese el numero del planeta</label>

<input type="text" name="numero" placeholder="Ingrese el numero del planeta" /><br />

<label>Ingrese su peso</label>

<input type="text" name="peso" placeholder="Ingrese su peso" /><br />

<input type="submit" value="Enviar" />

</form>

<?php

if ($_POST) {

    $gravedadPlanetas = array(

        "Mercurio" => 3.7,

        "Venus" => 8.87,

        "Tierra" => 9.81,

        "Marte" => 3.71,

        "Júpiter" => 24.79,

        "Saturno" => 10.44,

        "Urano" => 8.87,

        "Neptuno" => 11.15

    );

    $numero = $_POST['numero'];

    if ($numero < 1 || $numero > 8) {

        echo "Planeta no valido";

        exit();

    }

    $peso = $_POST['peso'];

    $numeros = array_keys($gravedadPlanetas);

    $planeta = $numeros[$numero-1];

...

Descargar como (para miembros actualizados)  txt (8.6 Kb)   pdf (62.9 Kb)   docx (43.7 Kb)  
Leer 8 páginas más »
Disponible sólo en Clubensayos.com