I just started learning java and I thought I'd build a BMI program for my friend.
But whenever I enter my height and mass it returns 0 rather than the BMI value.
import java.util.Scanner;
public class calculator {
public static void main(String[] args) {
int a, kg, height;
Scanner scanner = new Scanner(System.in);
System.out.println("What is your height in meter?");
height = scanner.nextInt();
System.out.println("What is your Mass in KG?");
kg = scanner.nextInt();
height = height * height;
double BMI = kg/height;
System.out.println(BMI);
}
}