Voici mon code. Pour une raison quelconque, mon IMC n'est pas calculé correctement. Lorsque je vérifie la sortie sur une calculatrice pour ce : (10/((10/100)^2)))
J'obtiens 1000, mais dans mon programme, j'obtiens 5. Je ne suis pas sûr de ce que je fais mal. Voici mon code :
import javax.swing.*;
public class BMI {
public static void main(String args[]) {
int height;
int weight;
String getweight;
getweight = JOptionPane.showInputDialog(null, "Please enter your weight in Kilograms");
String getheight;
getheight = JOptionPane.showInputDialog(null, "Please enter your height in Centimeters");
weight = Integer.parseInt(getweight);
height = Integer.parseInt(getheight);
double bmi;
bmi = (weight/((height/100)^2));
JOptionPane.showMessageDialog(null, "Your BMI is: " + bmi);
}
}