Java

yukikage 发表于 3个月前 · 关联问题 体型判断

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); float h = sc.nextFloat(); float w = sc.nextFloat(); float t = w / h / h; if (t < 18) System.out.print("underweight"); else if (t >= 18 && t < 25) System.out.print("normal"); else if (t >= 25 && t < 27) System.out.print("overweight"); else System.out.print("obese"); } }