Discuss / Java / 我觉得每层判断应该可以从小到大吧

我觉得每层判断应该可以从小到大吧

Topic source

黯然

#1 Created at ... [Delete] [Delete and Lock User]

double bmi = weight / Math.pow(height, 2);

if (bmi < 18.5)

  • System.out.print("You are too thin");

else if (bmi < 25)

  • System.out.print("You are normal");

else if (bmi < 28)

  • System.out.print("You are little fat");

else if (bmi < 32)

  • System.out.print("You are fat");

else

  • System.out.print("You are too fat");

//全部统一左闭右开


  • 1

Reply