-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathex14.js
38 lines (28 loc) · 1.07 KB
/
ex14.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
let altura = Number (prompt ("Digite sua altura:"))
let peso = Number (prompt ("Digite seu peso:"))
let calculaIMC = () => (peso / (altura ** 2))
console.log ("IMC:" + calculaIMC().toFixed (1));
function classificacaoIMC (){
let imc = calculaIMC();
switch (true){
case imc < 18.5:
console.log ("Abaixo do peso!");
break;
case imc >= 18.5 && imc <= 24.9:
console.log ("Peso normal.");
break;
case imc >= 25 && imc <=29.9:
console.log ("Sobrepeso!");
break;
case imc >= 30 && imc <= 34.9:
console.log ("Obesidade grau 1!");
break;
case imc >= 35 && imc <= 39.9:
console.log ("Obesidade grau 2!");
break;
case imc >= 40:
console.log ("Obesidade grau 3 (mórbida)!");
break;
};
};
classificacaoIMC ();