Skip to content

Instantly share code, notes, and snippets.

@dilakv
Created February 5, 2021 13:29
Show Gist options
  • Save dilakv/68237c8beccbf966680b5acb17edee22 to your computer and use it in GitHub Desktop.
Save dilakv/68237c8beccbf966680b5acb17edee22 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Curso - PHP - While</title>
</head>
<body>
<?php
# Estructuras Repetitivas
# While
$i = 0;
$numero = 100;
$cuantos_numeros_quiero = 50;
$multiplos_de = 3;
while ($numero <= 2000) {
if($numero % $multiplos_de == 0)
{
echo "Número par: $numero <br />";
$i += 1;
}
if($i >= $cuantos_numeros_quiero)
{
break;
}
$numero += 1;
}
//seguimos adelante
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment