Skip to content

Instantly share code, notes, and snippets.

@lucasinaciodev
Created July 9, 2019 14:29
Show Gist options
  • Save lucasinaciodev/5d124624799e45939477e8343206c76b to your computer and use it in GitHub Desktop.
Save lucasinaciodev/5d124624799e45939477e8343206c76b to your computer and use it in GitHub Desktop.
tabuada de 1 a 10
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="_css/estilo.css"/>
<meta charset="UTF-8"/>
<title>Tabuada - resolução de exercício | front-end</title>
</head>
<body>
<div>
<form method="GET" action="tabuada.php">
<label for="num">Número: </label>
<select id="num" name="num">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
</select>
<input type="submit" class="botao" value="Tabuada"/>
</form>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="_css/estilo.css"/>
<meta charset="UTF-8"/>
<title>Tabuada - resolução de exercício | back-end</title>
</head>
<body>
<div>
<?php
$num = $_GET['num'];
$c = $num;
switch($num){
case 1: for($i = 1; $i <= 10; $i++){
if($c == $num){
echo "<h3>Mostrando a tabuada de $num</h3>";
$c--;
}
$result = $num * $i;
echo $num . "x" . $i . " = " . $result . "<br/>";
}
break;
case 2: for($i = 1; $i <= 10; $i++){
if($c == $num){
echo "<h3>Mostrando a tabuada de $num</h3>";
$c--;
}
$result = $num * $i;
echo $num . "x" . $i . " = " . $result . "<br/>";
}
break;
case 3: for($i = 1; $i <= 10; $i++){
if($c == $num){
echo "<h3>Mostrando a tabuada de $num</h3>";
$c--;
}
$result = $num * $i;
echo $num . "x" . $i . " = " . $result . "<br/>";
}
break;
case 4: for($i = 1; $i <= 10; $i++){
if($c == $num){
echo "<h3>Mostrando a tabuada de $num</h3>";
$c--;
}
$result = $num * $i;
echo $num . "x" . $i . " = " . $result . "<br/>";
}
break;
case 5: for($i = 1; $i <= 10; $i++){
if($c == $num){
echo "<h3>Mostrando a tabuada de $num</h3>";
$c--;
}
$result = $num * $i;
echo $num . "x" . $i . " = " . $result . "<br/>";
}
break;
case 6: for($i = 1; $i <= 10; $i++){
if($c == $num){
echo "<h3>Mostrando a tabuada de $num</h3>";
$c--;
}
$result = $num * $i;
echo $num . "x" . $i . " = " . $result . "<br/>";
}
break;
case 7: for($i = 1; $i <= 10; $i++){
if($c == $num){
echo "<h3>Mostrando a tabuada de $num</h3>";
$c--;
}
$result = $num * $i;
echo $num . "x" . $i . " = " . $result . "<br/>";
}
break;
case 8: for($i = 1; $i <= 10; $i++){
if($c == $num){
echo "<h3>Mostrando a tabuada de $num</h3>";
$c--;
}
$result = $num * $i;
echo $num . "x" . $i . " = " . $result . "<br/>";
}
break;
case 9: for($i = 1; $i <= 10; $i++){
if($c == $num){
echo "<h3>Mostrando a tabuada de $num</h3>";
$c--;
}
$result = $num * $i;
echo $num . "x" . $i . " = " . $result . "<br/>";
}
break;
case 10: for($i = 1; $i <= 10; $i++){
if($c == $num){
echo "<h3>Mostrando a tabuada de $num</h3>";
$c--;
}
$result = $num * $i;
echo $num . "x" . $i . " = " . $result . "<br/>";
}
break;
}
?>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment