I am trying to code a basic command line BMI Calculator in Java and for some reason every time I run the code and enter my height and weight, 0 is outputted. Please help me understand where I have made a mistake.
import java.util.Scanner;
public class Chap2 {
public static void main(String[] args){
Scanner reader = new Scanner(System.in);
System.out.println("Enter your height in inches: ");
int myHeight = reader.nextInt();
System.out.println("Enter your weight in lbs: ");
int myWeight = reader.nextInt();
int Bmi = (myWeight/myHeight/myHeight)*703;
System.out.println("Your BMI is " + Bmi + ".");
}
}
And my output is as follows:
Enter your height in inches:
68
Enter your weight in lbs:
180
Your BMI is 0.