-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathBMI.java
More file actions
34 lines (25 loc) · 792 Bytes
/
BMI.java
File metadata and controls
34 lines (25 loc) · 792 Bytes
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
/*
program to calculate the BODY MASS INDEX
PRACTICE :: if-else block in java
*/
package basic_package;
import java.util.Scanner;
public class BMI {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("\nenter your weight in KG :: ");
float weight = sc.nextFloat();
System.out.print("\nenter your height in M:: ");
float hig = sc.nextFloat();
float BMI = (weight / (hig * hig));
System.out.println(BMI);
if (BMI < 18.5)
System.out.println("underweight");
else if (BMI < 25)
System.out.println("normal");
else if (BMI < 30)
System.out.println("overweight");
else
System.out.println("obese");
}
}