Nome: Milena Cristina dos Santos Oliveira Lima
Nome: Raquel Vitória Braga Zerneri
LISTA PHP
1- <!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<title>Estrutura de Repetição</title>
</head>
<body>
<form action="[Link]" method="post">
Digite a estação: <input type="text" name="esta">
<input type="submit" value="Enviar">
</form>
</body>
</html>
<?php
$esta = $_POST ["esta"];
switch ($esta){
case "outono":
echo "21 de março a 21 de junho";
break;
case "inverno":
echo "21 de junho a 23 de setembro";
break;
case "primavera":
echo "23 de setembro a 21 de dezembro";
break;
default:
echo "21 de dezembro a 21 de março";
break;
}?>
2- <!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UFT-8">
<title>ex 2</title>
</head>
<body>
<h1>Números Ímpares entre 100 e 200</h1>
<?php
$numero = 101;
while ($numero <= 200) {
echo $numero . "<br>";
$numero += 2;
}
?>
</body>
</html>
3- <!DOCTYPE html>
<html>
<head>
<title>ex 3</title>
</head>
<body>
<h1>Números Pares entre 200 e 300</h1>
<?php
for ($i = 200; $i <= 300; $i++) {
if ($i % 2 === 0) {
echo "<br>$i<br>";
}
}
?>
</body>
</html>
4- <!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<title>ex 4</title>
</head>
<body>
<h1>Repetição de Frases</h1>
<form method="POST" action="">
<label>Digite um valor:</label>
<input type="number" name="valor" min="0" required>
<input type="submit" value="Enviar">
</form>
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$valor = $_POST['valor'];
if ($valor == 0) {
echo "Bom dia:";
echo "Bom dia";
} else {
echo "a frase será repetida Bom dia $valor vezes:<br>";
for ($i = 1; $i <= $valor; $i++) {
echo "Bom dia<br>";
}
}
}
?>
</body>
</html>
5- <!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Exercicio 5</title>
</head>
<body>
<form action="[Link]" method="get">
<label>Digite um numero</label>
<input type="number" name="a">
<input type="submit" value="Enviar">
</form>
</body>
</html>
<?php
for ($num = $_GET["a"]; $num > 0; $num--){
echo $num . "<br>";
?>
6- <!DOCTYPE html>
<html>
<head>
<title>ex 6</title>
</head>
<body>
<h1>Intervalo entre valor e seu quadrado</h1>
<form method="POST" action="">
<label>Digite um valor:</label>
<input type="number" name="valor" required>
<input type="submit" value="Calcular">
</form>
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$valor = $_POST['valor'];
$quadrado = $valor * $valor;
$intervalo = abs($valor - $quadrado);
echo "<br>O intervalo entre $valor e seu quadrado que é $quadrado é:<br> $intervalo<br>";
}
?>
</body>
</html>
7- <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>exercicio 7</title>
</head>
<body>
<form action="[Link]" method="get">
<label>Digite um número : </label>
<input type="number" name="num">
<input type="submit" value="Enviar">
</form>
</body>
</html>
<?php
$num = $_GET["num"];
$tab = $num;
$nm = 0;
while($nm<=10){
echo $nm . " x " . $tab . " = " . ($nm * $tab) . "<br>";
$nm++;
?>
8- <?php
$com = 100;
$fim = 200;
for($i = $com; $i <= $fim;$i++){
if ($i % 4 == 0){
echo "pong ,";
} elseif ($i % 2 != 0){
echo $i .",";
else {
echo "ping,";
?>