import java.io.*;
import java.lang.*;
class BmiCalc {
public static void main(String args[]) throws IOException {
float h, w, bmi;
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter the weight(in kgs):");
w = Float.parseFloat(br.readLine());
System.out.println("enter the height(in meters):");
h = Float.parseFloat(br.readLine());
bmi = w / (h * h);
System.out.println("your BMI(body mass index) value is" + bmi);
System.out.println("if your BMI is '<18' you are under weight");
System.out.println("if your BMI is in between '18 and 24 ' you are normal weight");
System.out.println("if your BMI is '>25' you are under weight");
System.out.println("if your BMI is '>30' you are suffering from obesity");
} catch (NumberFormatException a)
{
System.out.println(a);
}
}
}
OUTPUT:
enter the weight(in kgs):
79
enter the height(in meters):
1.74
your BMI(body mass index) value is26.093275
if your BMI is '<18' you are under weight
if your BMI is in between '18 and 24 ' you are normal weight
if your BMI is '>25' you are under weight
if your BMI is '>30' you are suffering from obesity