We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b300bac commit fc25513Copy full SHA for fc25513
1 file changed
BMI.java
@@ -0,0 +1,27 @@
1
+import java.util.Scanner;
2
+public class BMI{
3
+ public static void main(String[] args) {
4
+ Scanner scanner = new Scanner(System.in);
5
+
6
+ System.out.print("Enter your weight in kilograms: ");
7
+ double weight = scanner.nextDouble();
8
9
+ System.out.print("Enter your height in meters: ");
10
+ double height = scanner.nextDouble();
11
12
+ double bmi = weight / (height * height);
13
+ System.out.printf("Your BMI is: %.2f%n", bmi);
14
15
+ if (bmi < 18.5) {
16
+ System.out.println("You are underweight.");
17
+ } else if (bmi >= 18.5 && bmi < 24.9) {
18
+ System.out.println("You have a normal weight.");
19
+ } else if (bmi >= 25 && bmi < 29.9) {
20
+ System.out.println("You are overweight.");
21
+ } else {
22
+ System.out.println("You are obese.");
23
+ }
24
25
+ scanner.close();
26
27
+}
0 commit comments