<meta charset="UTF-8">
<h1>PROGRAMA PARA CALCULAR IMC - VERSION 2.0</h1>
<script>
function jumpLine() {
document.write("<br><br><br>")
}
function print(frase) {
document.write(frase);
jumpLine();
}
function calculateImc(weight,height) {
return(weight / (height * height));
}
name = prompt("Informe su Nombre");
weightInfo = prompt(name + " Informe su Peso");
heightInfo = prompt(name + " Informe su Altura");
imcCalculated = calculateImc(weightInfo,heightInfo);
print(name + " el imc calculado es: " + Math.round(imcCalculated));
if (imcCalculated < 18.5){
print("IMC Abajo de lo recomendado");
}
if (imcCalculated >= 18.5 && imcCalculated <= 24.9){
print("IMC Normal de lo recomendado");
}
if (imcCalculated > 25 && imcCalculated <= 29.9){
print("IMC en Sobrepeso de lo Recomendado");
}
if (imcCalculated > 30){
print("IMC en Obesidad de lo recomendado");
}
</script>