-
Notifications
You must be signed in to change notification settings - Fork 1
/
Bmi.java
35 lines (27 loc) · 843 Bytes
/
Bmi.java
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
package ChapterTwo;
import java.util.Scanner;
public class Bmi {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
System.out.println("Enter Weight In Pounds");
double pounds= input.nextDouble();
System.out.println("Enter Height In Inches");
double inches= input.nextDouble();
double weight=pounds*0.45359237;
double height= inches*0.0254;
double bmi = weight/height*height;
System.out.print("Bmi is " +bmi);
if (bmi < 18.5){
System.out.println("Underweight");
}
else if (bmi < 25){
System.out.println("Normal");
}
else if (bmi < 30){
System.out.println("over Weight");
}
else {
System.out.println("obese");
}
}
}