Skip to content

Instantly share code, notes, and snippets.

@ZeusAFK
Created May 9, 2018 19:59
Show Gist options
  • Save ZeusAFK/661af1859838142ff5fc1adbe5db701c to your computer and use it in GitHub Desktop.
Save ZeusAFK/661af1859838142ff5fc1adbe5db701c to your computer and use it in GitHub Desktop.
<?php
$resultado = false;
if(isset($_POST['enviar']) && $_POST['enviar'] == 1){
$resultado = true;
$a = $_POST['a'];
$b = $_POST['b'];
$c = $_POST['c'];
$mayor = '';
if($a > $b && $a > $c) $mayor = 'A';
elseif($b > $a && $b > $c) $mayor = 'B';
elseif($c > $a && $c > $b) $mayor = 'C';
else $mayor = 'SON IGUALES';
/* Realizar un algoritmo que determine el mayor entre A, B y C o si son iguales */
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<form action="test.php" method="post">
<h2>Calcular el mayor de 3 numeros</h2>
<hr/>
<br/>
<span>A:</span>
<input type="text" name="a" />
<br/><br/>
<span>B:</span>
<input type="text" name="b" />
<br/><br/>
<span>C:</span>
<input type="text" name="c" />
<br/><br/>
<input type="hidden" name="enviar" value="1" />
<button>Enviar</button>
<br/><br/>
<?php
if($resultado){
echo "El mayor es: " . $mayor;
}
?>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment