<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Adivinador</title>
</head>
<body>
<meta charset="utf-8">
<h1>JUEGO DE ADIVINACION </h1>
<script type="text/javascript">
function saltarLinea() {
document.write("<br><br>");
}
function imprimeHtml(texto) {
document.write("<big>Acertó !<big>");
saltarLinea();
}
var numeroN = parseInt(prompt("Numero maximo de adivinador: (sorteará del 1 al ...)"));
document.write("Numero limite elegido = " + numeroN + " ... sorteando entre 1 y " + numeroN + "<br>");
var numeroDeUsuario = parseInt(prompt("Digite un numero del 1 al " + numeroN));
document.write("Numero tipeado = " + numeroDeUsuario + "<br>");
var numeroRandom = parseInt(Math.random() * (numeroN - 1 + 1) + 1);
document.write("Numero Aleatorio = " + numeroRandom + "<br>");
if (numeroDeUsuario == numeroRandom) {
imprimeHtml();
} else {
if (numeroDeUsuario > numeroRandom) {
document.write("<big>Fallaste, tu numero fue MAYOR al sorteado...<big>");
} else {
document.write("<big>Fallaste, tu numero fue MENOR al sorteado...<big><br>");
}
}
</script>
</body>
</html>